1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

[ask] Dear webmaster Help me to solve this ..

Discussion in 'CSS' started by cy99dasilva, Oct 19, 2011.

  1. #1
    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 ,
     
    Last edited by a moderator: Oct 19, 2011
    cy99dasilva, Oct 19, 2011 IP
  2. Jhonne

    Jhonne Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    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 :)
     
    Jhonne, Oct 20, 2011 IP
  3. shortcircuit

    shortcircuit Peon

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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>
     
    shortcircuit, Oct 20, 2011 IP
  4. cy99dasilva

    cy99dasilva Member

    Messages:
    158
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #4
    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 ?
     
    cy99dasilva, Oct 20, 2011 IP
  5. you-me

    you-me Peon

    Messages:
    67
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    codes are looking fine. recheck the path and image name.
     
    you-me, Oct 20, 2011 IP
    shortcircuit likes this.
  6. shortcircuit

    shortcircuit Peon

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Excellent advice you-me; reputation added.
     
    shortcircuit, Oct 21, 2011 IP