Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    <img height="0">

    Hello, I am using <img> tags with 0 height and a set width without a src to make sure that certain things are big enough when I use %'s for widths. The problem is when I do this, you can't see the img, but it takes up too much vertical space. Can anyone tell me what i could do about this? Thanks a lot.

  • #2
    New Coder
    Join Date
    Oct 2002
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well, you arent going to see the image if the height is 0 (if that was one of the problems). i dont think it should show any vertical space, but if you post the html i could look at it and it would be easier to solve your problem.

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is the code that I am currently using:
    Code:
    <body>
    <img width="800" class="spacer"/>
    <table class="header" rows="2" cols="2" cellspacing="0" width="100%" cellpadding="0" height="120">
    The declaration for the spacer class is:
    Code:
    img.spacer {height: 0px; border: 0px 0px 0px 0px; margin: 0px;}
    Any ideas? Thanks a lot.

  • #4
    New Coder
    Join Date
    Oct 2002
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well, i know if you dont define the height when using a defined width, that it assumes the same dimension for the height. So, if you define the table's height as something other than 0, it will be that height.

    <img width="800" class="spacer" height="20"/>
    <table class="header" rows="2" cols="2" cellspacing="0" width="100%" cellpadding="0" height="theheightyouwant">

  • #5
    New Coder
    Join Date
    Jun 2002
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So you are saying that the style defined is not working?

  • #6
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    why not place the width and height in the css
    also, you have the border specifying every side, if its all the same why not just use shorthand like you did with the margin?
    border:0px;

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    height and width are deprecated attributes of the table tag - should only appear in <td> tags.

    any element (even a 0px high image) is assumed to be rendered in a line conforming to the parental font specs.


    .spacer {font-size:1px}

    should help assure that any line break below the image (new tr of br) doesn't cause as much vertical space.
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #8
    New Coder
    Join Date
    Jun 2002
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, that didn't work and I am refering to the <img>, not to the table. Any other ideas.

  • #9
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    first off use a 1x1 invisible pic as your source. As mentioned above: A 0 Pixel height means it will do nothing at all.

  • #10
    New Coder
    Join Date
    Jun 2002
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, I got it to work in IE with the following:
    Code:
    <img width="800" height="1" src="transparent.gif"/><br style="line-height: 1px; font-size: 1px;"/>
    But it still doesn't work in Netscape 7. Any ideas?
    Thanks a lot.

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    ColoRockyz
    Posts
    1,646
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Any img with a 1 px size will be frowned upon in search engines. The reason is that ppl stuff alt tags in there...Sorry...Better figure out an better way unless you don't care about search engines.
    Zoobie or not Zoobie...That is the problem.
    <body onUnload="flush( ! )">

  • #12
    New Coder
    Join Date
    Jun 2002
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If it will be frowned upon than do you have any other way to accomplish the same thing without an image? I want to make the table with my content 100%, but I never want it to be smaller than 800px wide. Thanks a lot.


  •  

    Posting Permissions

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