Reputation: 11
I want to add some background colour to block h1 tag but I don't want to see background behind the text. Is it possible?
For example background with (-), It will seen like this:
Welcome -----------------
after text like filling with (-)
Thanks for help
Upvotes: 0
Views: 137
Reputation: 2233
<style type="text/css">
h1 {
width: 200px;
background-image: url(line.png);
background-repeat: repeat-x;
background-position: left bottom;
}
h1 span {
background-color: #FFF;
}
</style>
<h1><span>Welcome</span></h1>
see this example: http://jsfiddle.net/WtPB5/2/
Upvotes: 0
Reputation: 5243
Declare the h1
tag as as inline-block
, and keep it within a div
. Assign th required the background color to the div
while assigning a background of white to the h1
. You will get the desired effect.
Upvotes: 1