html - Set background-image to a div -
i have tried code page follows:
<div class="conttent-group"> <div class="conttent-group-body"> <div class="conttent-body-right"> <div class="conttent-body-left"> <h1><a href="#" style="text-decoration:none">news operations</a></h1> </div> </div> </div> </div>
and although following css:
* { background-color: #006; } .conttent-group { margin-top: 5px; height: 300px; width: 788px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; background: white; } .conttent-group-body { margin-left: 4px; margin-top: 5px; width: 386px; height: 30px; float: left; background: url (image / module-bg-bodynew.jpg) repeat-x top center; } .conttent-body-right { height: 30px; background: url (image / module-bg-rightnew.jpg) top right no-repeat; } .conttent-body-left { background: url (image / module-bg-leftnew.jpg) top left no-repeat; height: 30px; } .conttent-body-left div { background: #fff; border:> 1px solid # c6b389; border-top: none; padding: 0; margin-top: 7 pixels; height: 243px; } .conttent-body-left h1 { display: block; margin: 0; padding: 20px 0 0 7 pixels; text-align: left; font-weight: bold; color: # e1f1fe; font-size: 13px; }
but when running code see background-color
* { background-color: # 006; }
and not background-images have set. how can fix , show images?
currently using * {background-color: #006}
. * selector
targets every element, thats on side, thats why every background color same.
when using image background, first of file path:
/index.html /style.css /images/ /images/picture1.jpg /images/picture2.jpg
if want target picture, have choose file path regarding css file. in case example path images/picture1.jpg
. although aware of uppercase , lowercase letters inside file structure (like images
or images
) or not wanted spaces.
using can set background-image, , although add multiple variables, like:
background-image: url(images/picture1.jpg); /* no spaces inside url */ background-repeat: no-repeat; /* or "repeat-x", "repeat-y" */ background-size: cover; /* fullscreen background */ background-color: #fff /* background images not cover */ /* or combine them 1 */ background: url(images/picture1.jpg) no-repeat top center;
furthermore have got quite lot of errors inside code. maybe should consider refreshing basics, using online helpers codeacademy or else find.
Comments
Post a Comment