aurel
aurel

Reputation: 3122

is there a way to break from this inherited padding in css?

I have this HTML:

<ul>
  <li>content <span>more</span></li>
</ul>

and this is my CSS:

li{
  padding: 30px;
}

span{
  padding-top: -20px;
}

the padding on the span does not take effect. I could work around it by changing the HTML, but now that I was faced with this, I wanted to learn whether there is a work around or not.

Upvotes: 1

Views: 66

Answers (2)

pomaxa
pomaxa

Reputation: 1746

padding-top on inline element wouldn't work! Use block element, or set span { display:block }.

Upvotes: 2

user818991
user818991

Reputation:

Set your <span> to {display:inline-block}

Upvotes: 1

Related Questions