css - Cant get the pseudo class before to work -
so here's i'm trying do,
i want add top background strip(of height 30px) how stackoverflow has using pseudo class before. know can done without i'm interested know if can accomplished using :before pseudo class.
here's code,
<div class="container"> //other divs </div>
and here's css i'm using,
.container:before { content: " "; background-image:url(../images/head-bg.jpg); background-repeat:repeat-x; min-height:30px; }
i read somewhere content: " ";
needs added pseudo class work i've added nothing in quotes.
i've tried removing background code css , adding text within content quotes , works. however, when add code background doesn't.
i'll grateful if point out mistake doing this.
thanks time.
you should set width
of .container
whatever need be. should use height
instead of min-height
. :before
, :after
pseudo elements display:inline
default, in order height
, width
applied you'll need change display
.
.container:before { content: ""; background-image:url(../images/head-bg.jpg); background-repeat:repeat-x; height:30px; width:30px; display:inline-block; }
also can use empty string content
.
Comments
Post a Comment