Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

positioning a span within a li

Tags:

html

css

ive got a list set up with a background image set to the left of each of the lines of text although they dont seem to line up, i put a span around the text to try and reposition the text but it didnt seem to work

heres the code im using..

HTML

<ul class="price-features">
<li><span>One page website with contact form</span></li>
<li><span>Social Media Integration</span></li>
<li><span>One year hosting + Domain registration</span></li>
</ul>

CSS

 .price-features{
margin-top:30px;
 }

 .price-features li{
background-image:url(/images/prices/orange-arrow.png);
background-repeat:no-repeat;
background-position:left;
padding-left:15px;
height:30px;
border-bottom:#999 1px solid;
background-color:#996;
 }

 .price-features li span{
  padding-top:5px;
 }

http://i.stack.imgur.com/rV1LM.png

like image 630
Gezzamondo Avatar asked Jul 06 '12 22:07

Gezzamondo


People also ask

Can you have a span inside an LI?

Yes, absolutely fine. An <li> can contain either block-level or inline elements.

Can you put a span inside an a tag?

SPAN is a GENERIC inline container. It does not matter whether an a is inside span or span is inside a as both are inline elements.

Can I put span inside heading?

Yes, it's typically fine to use a span inside of an h1 . span is an inline element, so it's typically okay to use it inside anything (that allows elements inside it!)

Can a span go inside a div?

As all phrasing content is flow content, it means phrasing element can be used in all of flow content. The phrasing elements can only contain other phrasing elements, for example, you can't put div inside span.


1 Answers

Padding only affects block-level elements. You'll need to either change your span to be a block-level element or override the default display to be block or inline-block.

.price-features li span{
  display: block;
  padding-top:5px;
}
like image 127
Jesse Bunch Avatar answered Sep 21 '22 14:09

Jesse Bunch