How bad is to store all background images in CSS? -
How bad is to store all background images in CSS? -
i have created layout of website (template). used photoshop design image , sliced create divs. gave me html file including html , css code. separated these in 2 files html , css. background images beingness called within <div id="idname"> tags <img src=... tags. changed this. loaded images in css file
idname { background-image: url(url); } all images in site loaded creating background whole.
now question is: bad practice? because if leave images within <div> tags wont able set content on top of image. background-image attribute in css file can set content anywhere, not having worry background.
no, fine, , may best practice background images. moving image declarations style sheet means images may downloaded little bit later, browsers should have plenty other resources load in meantime, , you'll want prioritize html , stylesheets before background images anyways.
just don't utilize css backgrounds actual images: if fallback background color alter meaning (i.e. image content), should utilize <img> elements alt= attribute. if you're not sure whether idea, consider this question.
to increment performance (by reducing number of http requests), may want consider using css sprites.
css
Comments
Post a Comment