Free Advertising - Internet Dating - Reference And Education Articles - Name tag - Debt Consolidation

PDA

View Full Version : Button with long label does not wrap in IE, but does with FF


dfrechet
Nov 15th 2004, 8:37 am
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>

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;
}

Smyrl
Nov 15th 2004, 9:13 am
Should this - color:#FFF; be changed to color;#ffffff

dfrechet
Nov 15th 2004, 10:05 am
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

expat
Nov 15th 2004, 10:32 am
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

dfrechet
Nov 15th 2004, 11:12 am
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