Jump to content

css style vs html <div style


jwcane
 Share

Recommended Posts

My css has a background style with non-repeating image, that works fine:
.HeaderImg1b {
background-image: url("/photodesign/images/pgHeader-1b.jpg");
background-repeat:no-repeat;
}
To create that image on the fly, the <div style tag is more convenient, as in:
<div
style="background: url(/photodesign/images/pgHeader-1b.jpg)>"
</div>
This latter code has some error that is preventing the image from being rendered.
Have also tried adding quotes inside parens with and without the outer set of quotes, and no quotes. Behavior is unchanged.
Would appreciate an idea of what is wrong.
Link to comment
Share on other sites

The relative addressing could be an issue if your external css file is in a different folder. Also note that in one case you have background and in the other you have background-image.

Link to comment
Share on other sites

Changed to Background-Image, with no change in results.

Link to comment
Share on other sites

<div

style="background: url(/photodesign/images/pgHeader-1b.jpg)>"
</div>
should be
<div style="background-image: url(/photodesign/images/pgHeader-1b.jpg);">
</div>
and it does help to set the height, else it will 0 height, and WILL show nadder.
Edited by dsonesuk
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...