Is there a clean CSS way to set the width of a div to the width of the background image you use for this div?
For example, right now I am doing this ...
#homeNav{
background-image:url(../images/navPieces/home.jpg);
width:165px;
text-align:right;
}
#aboutNav{
background-image:url(../images/navPieces/about.jpg);
width:81px;
text-align:center;
}
#competitorsNav{
background-image:url(../images/navPieces/competitors.jpg);
width:117px;
text-align:center;
}
I would not want to write the width of each div.
Any suggestions?
source
share