if you set width:25%; for the .button class it should be ok.
but you would need to change that if theres more buttons needed though
Main Topics
Browse All TopicsI have a container called Navbar which has multiple items called buttons. The number of buttons will varie, depending on the number of times its called. I want the buttons to stretch horizontally to fill up the entire NarBar space (horizontal as well). However, with my current CSS, it will only stay on the left, and the width doesnt change. Please help!
I have this CSS code:
#NavBar {
position:relative;
width: 760px;
height:: 32px;
float:left;
margin: 0 0 1px 0;
line-height: 15px;
background-color: #999999;
text-align:center;
vertical-align:middle;
}
#NavBar .button {
position:relative;
float: left;
width: auto;
/* min-width:107px !important;
min-width:100px; */
padding: 0 0 2px 0 !important; /* firefox */
padding: 1px 12px 1px 12px;
border-left:thin solid #FFFFFF;
text-align:center;
vertical-align:middle;
height: 30px;
line-height:15px;
background-color: #999999;
margin: 0 auto;
}
#NavBar a {
FONT-SIZE: 14px;
COLOR: #FFFFFF;
link="#FFFFFF"
vlink="#FFFFFF"
alink="#FFFFFF";
FONT-FAMILY: Arial, Helvetica, sans-serif;
TEXT-DECORATION: none;
font-weight: bold;
line-height: 15px;
position: relative;
color: #FFFFFF;
vertical-align: middle;
text-align:center;
min-width: 107px;
}
the html file with this part would look like:
<div id="NavBar">
<!-- Top Menu links go here -->
<div class="button"><a href="test1.html">Engineer
<div class="button"><a href="test1.html">Finance & IT</a></div>
<div class="button"><a href="test1.html">Human<br
<div class="button"><a href="test1.html">Manufact
</div>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I meant to say container, not folder.
I have 4 buttons that are within a container of a width of 760px. I may add a few more buttons as well, but I want the multiple buttons to fill the entire contents within the container itself.
In my current setup the four button widths do not change and only take up the left half of the container, while I want it to stretch the full length.
Then if I add a button, the overall widthd of each button would go down, making room for the 5th button, and so on....
Business Accounts
Answer for Membership
by: ThogekPosted on 2007-07-02 at 16:11:54ID: 19407601
Have you tried making the width of your "#NavBar .button" selector a percentage, such as 100%? Block elements' percentage widths are supposed to be taken as percentages of the parents' widths...