Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I change the background image of a div tag?

Status
Not open for further replies.

FancyPrairie

Programmer
Oct 16, 2001
2,917
US
What's the syntax for changing the background-image of a div tag?

I've tried:

divTagName.BackgoundImage = "url(folder\image.png)"
divTagName.BackgoundImage = "url(folder\\image.png)"
divTagname.Background-Image = "url(folder\image.png)"
divTagname.Background-Image = "url(folder\\image.png)"

Plus other combinations.

What am i doing wrong?
 
typed my examples wrong...

Should read divTagName.Style.BackgroundImage

Note I forgot to add Style
 
Never mind...got it to work

Must have mistyped something earlier because this worked:

divTagName.Style.BackgroundImage = "url(folder\image.png)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top