zefrolity zefrolity - 1 year ago 57
CSS Question

How to place text above an element in HTML/CSS?

Well, I want this text to be up the top roughly 20 PX from the top of the wrapper (background color) I did the margin up there but nothing happened if anyone can help it will be greatly appreciated.


.wrapper {
background-color: #01172c;

.footerid {
list-style: none;

.footerid li {
padding-left: 125px;
padding-top: 20px;
padding-bottom: 20px;
display: inline;
display: inline-block;

.footerid h3 {
padding-top: 20px;
margin-top: 20px;

<div class="wrapper">
<ul class="footerid">
<li><a href="#"><img src="logo-f.png" style=" width:80px; height:105px;"></a></li>

Run the code sample in full screen to see properly.

Answer Source

You have to indicate the li element about the vertical-align which I would set to top for this case

Please see https://jsfiddle.net/4zr9j3eg/

I have also disabled the padding property for your h3 element which will sumup the margin that make the text distance from the top to 40px

Also I changed the text-color to color: #fff; for debug easier