CSS Min-Width Headache

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Queez
    New Member
    • Jul 2007
    • 24

    CSS Min-Width Headache

    Hi,

    I've been having a problem with CSS that's driving me crazy. I'm basically trying to set the minimum width of a div to 750px and the width to 100%, so that viewed at a resolution under 800x600, the view will still hold shape and viewed above 800x600, the view will center (I'm using text-align: center to center the div once it's 100% wide).

    Makes sense? Here's the code:

    CSS:

    Code:
    .centerDiv
    {
        text-align:center;
        min-width:750px;
        width:100%;
    }
    HTML:

    Code:
    <html>
     ...
         <div class="centerDiv">Some text</div>
     ...
    </html>
    The trouble is, when using Visual Studio 2005, the "min-width" bit in the CSS shows a red underline saying "'min-width' is not a known CSS property name"... The weird thing is, I tried it anyway and it works great in IE7, but doesn't work in Firefox... (it's usually the other way round eh?). I'm almost 100% sure that min-width IS a valid CSS property name, so can someone please show me what I'm doing wrong?

    Thank you in advance,

    Oli

    PS if I use inline style:
    Code:
    <div style="min-width:750px;">Some Text</div>
    there's no error in Visual Studio, but I still get the same results.
  • Queez
    New Member
    • Jul 2007
    • 24

    #2
    Hey, my bad - I just tried it again and it's working in Firefox, not IE... so I guess there'll be loads of explanations out there.

    Still, this sucks, there's a min-height property, so why not put a bloody min-width in there too? Bastards.

    Comment

    • nitinpatel1117
      New Member
      • Jun 2007
      • 111

      #3
      Min-height and mid-width do exist, but they are just not supported by IE6, but are supported by other broswers and IE7.

      Comment

      • Queez
        New Member
        • Jul 2007
        • 24

        #4
        So min-width IS supported by IE7? Ok, thanks I'll give it a go.

        Comment

        • drhowarddrfine
          Recognized Expert Expert
          • Sep 2006
          • 7434

          #5
          Yes, it works on IE7 but poorly. It will probably be OK for what you want.

          Comment

          Working...