Dear , webmaster ... i want to ask to you some question . How i insert image to html using CSS . I've tried a lot ... but nothing happened . before </head> tag on my index.html i write like this <link href="css/style.css" rel="stylesheet" type="text/css" media="all"> for the css . i am using this script #example tag { background-image:url('images/bg.png')repeat-x; } after done , nothing happened on my index html . i've been check my tag on html and on the css a lot .. please tell me what should i do ? Thanks ,
Which element is it that you are trying to apply the background image to? Some tags are declared inline as default and are needed to be set to display:block in order to put a background image to it. Also if the element has no content more than the background image you might have to set height and width to it. However, it would be easier if you show the CSS and HTML code , and I'm sure you will get an answer rather quickly
administrationcy99; the way you wrote the code won't work, so here's two samples of both the CSS and HTML for you to try: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <title>Web Site Name</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css" media="screen"> #headline1 { background-image: url(images/newsletter_headline1.gif); background-repeat: no-repeat; background-position: left top; padding-top:68px; margin-bottom:50px; } #headline2 { background-image: url(images/newsletter_headline2.gif); background-repeat: no-repeat; background-position: left top; padding-top:68px; } </style></head> <body><div id="headline1">Some text … </div> <div id="headline2">Some more text .. </div> </body></html> +++++++++++++++++++++++++++++++++ Or, you can simply do it this way also: <html> <body> <h2>Web Site Name</h2> <img border="0" src="/images/image.jpg" alt="Image Alt Name" width="whatever size" height="whatever size" /> </body> </html>
i try this , i write , the <style type="text/css" media="screen"> before </head> tag . and write the css , on css doc .. but why still not working ?