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.

Min width on CSS div

Discussion in 'CSS' started by nasser, Sep 1, 2006.

  1. #1
    does any one knew how i could define a min width to a div or a table, without using images

    trying to make the page as light as possible

    thx
    SEMrush
     
    nasser, Sep 1, 2006 IP
    SEMrush
  2. Gordaen

    Gordaen Peon

    Messages:
    277
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    CSS does have a min-width property, but IE sucks as usual.
     
    Gordaen, Sep 1, 2006 IP
  3. blade69

    blade69 Peon

    Messages:
    44
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    This guy explains a min-width hack for IE
     
    blade69, Sep 5, 2006 IP
  4. hexed

    hexed Peon

    Messages:
    333
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ?!

    There is no need to use a min width for divs as far as I know. Just set your width and make sure to put a   in between divs


    <div style="width:500px">&nbsp;</div>

    Now if you're talking about height, that's a different story!

    hexed
     
    hexed, Sep 6, 2006 IP
  5. Gordaen

    Gordaen Peon

    Messages:
    277
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Setting a min-width is useful for your main content section. You can prevent it from going smaller than a certain size while not hindering the ability to stretch for higher resolutions. Setting an exact width prevents a design from being fluid. Using an entity outside of a div (or p, etc.) is not xhtml compliant.
     
    Gordaen, Sep 6, 2006 IP
  6. kk5st

    kk5st Prominent Member

    Messages:
    3,486
    Likes Received:
    367
    Best Answers:
    28
    Trophy Points:
    335
    #6
    If you want IE to have a min-width, you'll have to apply some kind of hack. Using an image is a very light weight way to go. Prepare a 1px × Npx image, where N = desired miniwidth and color = background, or transparent. GIFs are good for this. Use a conditional comment to insert it into that certain obsolete browser.
    
    div {
        width: 90%;
        min-width: 600px;
        }
    ===========
    <div>
      <!--[if lte IE6]>
        <img src="min600.gif" alt="" />
      <![endif] -->  <!-- do check the syntax of the cc before using -->
    
      <p>This div will have a width of 90% of the width of its parent, 
         except that it will not shrink below 600px.</p>
    </div>
    Code (markup):
    MSFT sz they will support min-?? in IE7.

    cheers,

    gary
     
    kk5st, Sep 9, 2006 IP
  7. +:::Spider25:::+

    +:::Spider25:::+ Peon

    Messages:
    69
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Good solutions :)
     
    +:::Spider25:::+, Sep 9, 2006 IP