Hi,
I had a question: as far as using pictures, is it proper practice to place pictures only inside the css file, only inside the html file, or both?
I'm getting the impression that you should pretty much put it all inside the css file, however, that makes me wonder about stuff like javascript rollover links, how would that work?
Thanks for the help,
-Sohrab
Pictures: <img> Proper Practice: place in CSS file or
Hi,
You can only place background images in your css file, although this may suit for a lot of purposes.
There is nothing wrong with including images in your html, just as there is nothing wrong with including text in your html.
In fact for accessibility its better to have important images in the foreground and make sure that they have their alt and title attributes defined.
Paul
Thanks. Very clear reply! :)
Thank you for your reply, it is most appreciated
-Sohrab
Pictures: <img> Proper Practice: place in CSS file or
I would agree with Pob. However, to play devils advocate and provide some food for thought:
CSS is for defining the presentation of your site, and images could very well be classified under presentation. If you look at something like CSS Zen Garden (http://www.csszengarden.com/) you can see there are no images in the HTML, which gives them the power to restyle it so completely and dramatically using only CSS...
Pictures: <img> Proper Practice: place in CSS file or
Hi,
I ageree with exorcyze that presentation should be separated from content .
If the presentation is in the form of images then this is fine in the CSS. I was thinking more of images that are pertinent to the content and add something to the content.
Alt and title attributes are important to screen readers and the like (and I believe also to search engines as well). Whereas background images in the CSS are ignored by both.
So I agree and disagree at the same time (if that's possible) .
Paul
Re: Pictures: <img> Proper Practice: place in CSS file
i agree with what has already been said about separating content from presentation, although i don't see anything wrong with a few images in the html. it's nicer to keep the majority in the background, to make for skin switching ala CSS zengarden.
however, that makes me wonder about stuff like javascript rollover links, how would that work?
as for javascript rollover links, well you can use pure CSS rollovers.