html - Have Text stacked above an element using CSS -



html - Have Text stacked above an element using CSS -

i trying acheive similar this

[ sometext ] [ someothertext] actualtext actualtext2

but getting like

som[etext ] someoth[ertext ] actualtext actualtext2

where [] denote image placed in background. semantically, want/need set stacked elements e.g.

<li class="software1"> <div class="overlay"> -soft1 </div> 20 </li>

where overlay element supposed text above actual text in front end of lis background.

i build little jsfiddle http://jsfiddle.net/a3vrd/3/ displaying issue

what want accomplish have text above above "normal" text , not elevated if next it.

i guess there many ways this. assuming don't want utilize background-repeat (because have set none) need give same width list elements background image plan use.

this similar markup yours have applied class background image element contain "overlay" text. used span tag because felt more natural me, div within of li valid, can utilize if prefer.

html:

<aside class="compatibility"> <ul> <li> <span class="software1">here's text</span>20</li> <li> <span class="software1">some other text</span>20</li> <li> <span class="software1">text of 1 </span>20</li> </ul> </aside>

css:

aside.compatibility ul { margin-top: 64px; list-style-type:none; position: relative; } aside.compatibility li { display:inline-block; padding-top:64px; margin-right:20px; width: 100px; text-align: center; } aside.compatibility .software1 { background-image: url("http://placehold.it/100x50"); } aside.compatibility li span { display: block; background-repeat: no-repeat; background-position: center; position:absolute; bottom: 20px; width: 100px; height: 50px; padding-top: 10px; }

html css

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -