Why Doesn't this Code Work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • royal ludhiana
    New Member
    • Jan 2008
    • 11

    Why Doesn't this Code Work

    hi all,

    I am having a simple CSS file with the following tag:

    .topdivision
    {
    width:100%;
    height:100px;
    background-image:url(../images/banner5.jpg);
    background-repeat:no-repeat;
    background-position:center ;
    }

    And as I am using this with ASP.NET page, I have given a reference in the page as:
    <link href="App_Theme s/rainy/rainy.css" rel="Stylesheet " type="text/css" />

    and I have used the "topdivisio n" tag like:

    <div id="div_top" class="topdivis ion" runat="server"> </div>

    I think everybit of process is fine, but I am unable to view the image I am using as a background(bann er5.jpg) image.
    Can you help me through.

    Regards,
    Royal
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    Are you sure the image is actually relative to the location you have the html page at?

    Comment

    • royal ludhiana
      New Member
      • Jan 2008
      • 11

      #3
      if I don't use the CSS and I try to display the images as:

      <div id="topdiv" style="backgrou nd-image:url(/images/banner5.jpg)"></div>


      it works fine this way. But I want to do the same thing using CSS.

      Regards,

      Royal

      Comment

      • Death Slaught
        Top Contributor
        • Aug 2007
        • 1137

        #4
        Try changing you code to this, and see if it works.

        [CODE=css] .topdivision {
        width:100%;
        height:100px;
        background-image:url(http://www.thescripts. com/forum/customavatars/avatar129709_10 .gif);
        background-repeat:no-repeat;
        background-position:center ;
        }[/CODE]

        And if it doesn't change you code to this.

        [CODE=css] .topdivision {
        width:100%;
        height:100px;
        background-image: url(http://www.thescripts. com/forum/customavatars/avatar129709_10 .gif);
        background-repeat:no-repeat;
        background-position:center ;
        }[/CODE]

        Thanks, Death

        Comment

        • drhowarddrfine
          Recognized Expert Expert
          • Sep 2006
          • 7434

          #5
          In the CSS, you are using a different relative path. There you show ../ while in the other you just show /

          Comment

          • Death Slaught
            Top Contributor
            • Aug 2007
            • 1137

            #6
            I was working more around a certain ' ' which has caused myself issues in the past.

            ~_^ Thanks, Death

            Comment

            Working...