html - Set Div Width to Background Image Width Css? -


is there pure css way of setting div width width of background image using div?

for instance right i'm 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'd love not have write in width of every div.

any suggestions?

unfortunately no, there isn't. css doesn't know width of specified background images. bit of javascript preloaded images , set div widths.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -