Jump to content

CSS/HTML Problem


Mudsaf
 Share

Recommended Posts

Somehow i cannot display background-image on my div id. So i have this Div

<div id="top_left"></div>

and this css

#top_left {background-image:url(img/bottom.jpg);background:no-repeat;background:top;background:left;width:25px;height:25px;

somehow it doesn't show the background image? Any help please. My paths

style.css (ROOT)index.html (ROOT)images (ROOT/img/)

Edited by Mudsaf
Link to comment
Share on other sites

Your background declarations are overwriting all your other background declarations. "background" is a property that writes all the different properties at once. If you had used another background declaration previously it will be overwritten by default values and the values you give it. Either write all the properties at once, or use separate properties. background-image: url(img/bottom-jpg);background-repeat: no-repeat;background-position: top left;

Link to comment
Share on other sites

Do you mean like this?

#top_left {background-image:url(img/top_left_corner.jpg)background:no-repeatbackground:topbackground:leftwidth:25pxheight:25px;}

If yes, still didin't work. Could you fix it for me. Either does this one above.

#top_left {background-image:url(img/top_left_corner.jpg);background:no-repeat;background-position: top left;width:25px;height:25px;}

Edited by Mudsaf
Link to comment
Share on other sites

Im trying to make website layout i got these images left top corner, top, right top corner, left, right, left bottom corner, bottom, right bottom corner. In the middle there should be background with black colour and text would go there.

Link to comment
Share on other sites

re-read his post carefully....

Your background declarations are overwriting all your other background declarations. "background" is a property that writes all the different properties at once. If you had used another background declaration previously it will be overwritten by default values and the values you give it. Either write all the properties at once, or use separate properties. background-image: url(img/bottom-jpg);background-repeat: no-repeat;background-position: top left;
if you don't want to include all the background properties and values in one line, then you will need to list them out separately like in Ingolme's example. Otherwise you would have to do something like:
background: url('image/path.jpg') no-repeat top left;

this is known as shorthand just look in the tutorialshttp://www.w3schools..._background.asp

Edited by thescientist
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...