June 15, 201313 yr Is it any way how to fit menu buttons automatically in div with static width ? I have two buttons and both has same padding is it any solution how to automatically adjust padding in case that third button is added ? Keep them in a middle with same padding from cell of div and each other but with ability to adjust when next button will be added . Hopefully someone will understand my language Live example here: http://jsfiddle.net/WPZ2n/
June 15, 201313 yr Author Not exactly ... let's say we have 50px width button , and 300px width of div . In case of three buttons it should be : space /button1/ space /button2/ space /button3/ space and space = 37,5px and together with buttons width it's 300px /100%/ of div width . If there is added fourth button I want it to automatically decrease the spaces between buttons ... it'll be 25px in this case . But when I'm thinking about it again , it's not possible by css ...
June 15, 201313 yr your besst option would be this div { width:450px; border:1px solid red; } li,ul { display:inline; border:1px dotted green; width:auto; padding:5px; Edited June 15, 201313 yr by pat24
June 15, 201313 yr I'm sure theres a better way had a few beers so head not functioning div { width:450px; border:1px solid red; overflow:hidden; } ul { width:100%; list-style-type:none; display:table; margin:0; padding:0; } li{ padding: 0 5px; border:1px dotted green; display: table-cell; width: auto; text-align: center; }
June 15, 201313 yr Author I'm sure theres a better way had a few beers so head not functioning div { width:450px; border:1px solid red; overflow:hidden; } ul { width:100%; list-style-type:none; display:table; margin:0; padding:0; } li{ padding: 0 5px; border:1px dotted green; display: table-cell; width: auto; text-align: center; } Many thanks ... that's exactly what I've been looking for , just improved width to concrette number , and working perfect ! Thanks a lot
Create an account or sign in to comment