SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Location
    Guelph Canada
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Not clear on some CSS in my site?

    Hi

    Could you please check my code.

    I don't understand why I have to include this peice of html
    Code:
    <div id="header">
    			<img src="Images/General/MainCanvas.jpg" width="100%" height="100%" alt="Treanor Hobbies" border="0" />
    	</div>
    when It seems like its already implied in the css file mysite.css
    Code:
    #header {
    	background-image:url(/Images/General/MainCanvas.jpg);
    	height:261px;
    	width: 800px;
    }
    Thing is if I remove the html it no longer displays banner. Where am I getting mixed up?

    Thanks
    Scott

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Are you sure that's the correct path to the image? Because if your CSS file is in a different directory, that will be the wrong path.

    Also, I hope that by "removing the HTML" you mean just the IMG and not the DIV as well!

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Location
    Guelph Canada
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Raffles

    It appears that it was my path that was the problem
    Code:
    background-image:url(/Images/General/MainCanvas.jpg);
    The first switch was causing the problem, when I removed it the problem seemed to be solved.

    Scott

  4. #4
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,478
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't set the width and height of the image in your HTML to 100&#37;. Just set the dimensions instead. Not everyone will be visiting your site using a CSS capable user-agent, and some UAs may even choke on the 100% width and height IMG element. I know my cell phone (for example) would.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •