I am trying to get four different layouts, some text with any other text on the left, right, top or bottom.
I have this code:
<div>
<span class="icon">H</span>
<span class="text">Hello</span>
</div>
Then this CSS
div { background: grey; position: absolute;}
.icon {font-family: calibri; position: absolute;}
//.text {padding-left: 15px;} .icon {left: 0;} // Icon left of text
//.text {padding-right: 15px;} .icon {right: 0;} //Icon right of text
//.text { padding-top: 15px; } .icon {top: 0;} // Icon top of text
//.text { padding-bottom: 15px; } .icon {bottom: 0;} // Icon bottom of text
Then, depending on which of the last four lines that I have broken, should determine the position of the icon text relative to the main text. However, it does not seem to work, and I can actually reach the position of "Icon left of text".
Can someone explain where I'm wrong.
Jimmy source
share