Reputation: 551
I need to set a background for a wrapped text. Is there a way to get this effect via css http://oi40.tinypic.com/ydlk4.jpg.
Upvotes: 0
Views: 76
Reputation: 1016
p {
/* like this */
padding: 1px 0;
/* or */
border-top: 1px solid black;
border-bottom: 1px solid black;
background-color: black;
display: inline;
color: #fff;
}
Upvotes: 0
Reputation: 85545
Just use display: inline;
to your element whatever it is div or p, etc.
Upvotes: 0
Reputation: 3144
here is a simple solution
a {
display:inline;
color:white;
padding:5px 0px;
line-height:30px;
background:black;
font-size:18px;
text-decoration:none;
}
Upvotes: 0
Reputation: 10140
Wrap your text in <span></span>
.
Or add display: inline-block
with<div></div>
Demo: http://jsfiddle.net/uNjT6/1/
Upvotes: 1