Reputation: 698
I have following HTML button in my webpage:
The buttons have to be fixed width and if texts overflow it's width it should be wrapped by white-space:normal
. The Search Staff (F2)
and Select Item(F3)
are wrapped correctly. But don't know why Company(F8)
and Product(F4)
buttons are not wrapping inside button. Here is the HTML layout for those button:
.menu_button {
width: 100px;
height: 50px;
background-color: #D0D0D0;
color: #0000FF;
font-size: 14px;
font-weight: bold;
cursor: pointer;
border-width: 4px;
white-space: normal;
vertical-align: middle;
}
<div id="option_bar">
<input id="check" type="button" class="menu_button" name="list_item" value="Item (F1)" />
<input id="check" type="button" class="menu_button" name="company" value="Company(F8)" />
<input type="button" class="menu_button" name="search" value="Search Staff (F2)" />
<input type="button" class="menu_button" name="select_item" value="Select Item (F3)" />
<input type="button" class="menu_button" name="product" value="Products (F4)" />
<input type="button" class="menu_button" name="bid" value="Bid (F6)" />
<input type="button" class="menu_button" name="letter" value="Letter (F7)" />
<input type="button" class="menu_button" name="price" value="Price (F9)" />
<input type="button" class="menu_button" name="print" value="Print (F12)" />
</div>
How to fix it?
Upvotes: 0
Views: 64
Reputation: 92
I am not sure what you are trying to achieve from this, but still you can add space between "Company" and "(F8)", that would do exactly what you require like in Search Staff (F2)
, similarly you can do this for Product (F4)
.
<div id="option_bar">
<input id="check" type="button" class="menu_button" name="list_item" value="Item (F1)" />
<input id="check" type="button" class="menu_button" name="company" value="Company (F8)" />
<input type="button" class="menu_button" name="search" value="Search Staff (F2)" />
<input type="button" class="menu_button" name="select_item" value="Select Item (F3)" />
<input type="button" class="menu_button" name="product" value="Products (F4)" />
<input type="button" class="menu_button" name="bid" value="Bid (F6)" />
<input type="button" class="menu_button" name="letter" value="Letter (F7)" />
<input type="button" class="menu_button" name="price" value="Price (F9)" />
<input type="button" class="menu_button" name="print" value="Print (F12)" />
Upvotes: 0
Reputation: 98
You can use the word-wrap
property.
The word-wrap property allows long words to be able to be broken and wrap onto the next line.
CSS syntax:
word-wrap: normal|break-word|initial|inherit;
p.test {
word-wrap: break-word;
}
Another way you can the same result is add an space between parenthesis and the last word letter.
Upvotes: 0