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.

Button with long label does not wrap in IE, but does with FF

Discussion in 'CSS' started by dfrechet, Nov 15, 2004.

  1. #1
    Hello,

    I'm having trouble making a button with a long label display the same in FireFox (1.0) and IE (6). The problem is that IE does not wrap the button label when it is longer that the specified width of the button. I want it to be identical to FF. During testing, I discovered that if I set the "overflow" property to "visible", IE will extend the width of the button to display the entire label. And if I remove or comment out the "overflow" property, the label is cut.

    Another problem I have with IE is that the button does not change color when the mouse pointer hovers over it. It works fine in FF.

    I have tried many things up to now, but nothing worked. ANY HELP OR ADVICE IS WELCOME.

    Thank you,
    Daniel

    Here is my code:

    button_test.htm:
    ----------------
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html><head>
    <style type="text/css" media="all">
    @import url(button_test.css);
    </style>
    </head><body>
    <button type="button">Button with a very long label</button>
    </body></html>
    Code (markup):
    button_test.css:
    ----------------
    html, body {
    background-color:#FFF;
    font-family:verdana,arial;
    line-height:15px;
    margin:10px;
    padding:0px 0px 0px 0px;
    width:300px;
    }
    
    button {
    background-color:#FF950D;
    border-bottom:1px solid #666;
    border-left:1px solid #FFAA3D;
    border-right:1px solid #666;
    border-top:1px solid #FFAA3D;
    color:#FFF;
    cursor:pointer;
    display:block, inline;
    font-family:verdana,arial;
    font-size:10px;
    font-weight:bold;
    margin-top:10px;
    min-height:22px;
    overflow:visible;
    text-align:center;
    vertical-align:middle;
    white-space:normal;
    width:100px;
    word-wrap:break-word;
    }
    
    button:hover {
    background-color: #FEBB64;
    } 
    Code (markup):

     
    dfrechet, Nov 15, 2004 IP
  2. Smyrl

    Smyrl Tomato Republic Staff

    Messages:
    13,740
    Likes Received:
    1,702
    Best Answers:
    78
    Trophy Points:
    510
    #2
    Should this - color:#FFF; be changed to color;#ffffff
     
    Smyrl, Nov 15, 2004 IP
  3. dfrechet

    dfrechet Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi Smyrl,

    The color property is fine. It is a shot-hand notation supported by all browsers.

    The format of an RGB value in hexadecimal notation is a '#' immediately followed by either three or six hexadecimal characters. The three-digit RGB notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For example, #fb0 expands to #ffbb00. This ensures that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies on the color depth of the display.

    For more info, visit www.w3.org/TR/2003/CR-css3-color-20030514/#color

    Thanks,
    Daniel
     
    dfrechet, Nov 15, 2004 IP
  4. expat

    expat Stranger from a far land

    Messages:
    873
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #4
    display:block, inline; .... if I remember corectly one combination of this is illegal I think inline is the one you want to use to generate a box with multiple lines allowing text break.....


    a.button:hover {
    background-color: #FEBB64;
    }
    should work for both

    M
     
    expat, Nov 15, 2004 IP
  5. dfrechet

    dfrechet Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you all,

    I was so absorbed and preoccupied at making it work via the style sheet that I simply did not think of other alternatives. I got a reply from A1ien51 in another forum telling me to insert <br /> tags in the label names.

    It is not the ideal solution, but it works.

    Thank you again,
    Daniel
     
    dfrechet, Nov 15, 2004 IP