center div w/ variable width
- Started
- Last post
- 15 Responses
- janne76
is this even possible?
i am tearing my hair out here.
- version30
<table>
- 7point340
how does it vary? depending on the content loaded inside?
- it is a horizontal menu, with ul containing li's inside a wrapping divjanne76
- client wants to add or remove menu buttons dynamically.janne76
- you got code somewhere i can look at? maybe i'm not understanding the issue7point34
- doesn't seem like it should be difficult7point34
- not sure about posting code here. and the whole is rather complex. fucking pushy clientjanne76
- 7point340
eventually there has to be a limit on how wide the div can be... i'm assuming there is only so much space for it to occupy and at the very least there is a set width boundary of the site, 960px or something, correct?
or are you saying they want the li to expand and fill the space no matter how many there are?
- there is indeed a limit. the real issue is languages the site will be in... so german may have longer words for instance..janne76
- 40% longer on average for germanflashbender
- janne760
thanks all.. i'll try adding a div as it seems ul is shitty to position..
- 7point340
get rid of the ul and just do anchors instead.
set them to display: block; and float: left; might be easier to handle with one less parent.
- janne760
7point34:
- insomnie0
Try this.
<script type="text/javascript">
window.onload=function() {
setWidth();
}function setWidth() {
var mywidth = document.getElementById('menu...
//alert(mywidth); //This would be the width of the menu.
document.getElementsByClassName... = mywidth; //Set the width for your wrap div to the width of the menu.
}
</script>
- insomnie0
Grr didnt copy it correctly.
- insomnie0
want me to email it to you?
- janne760
thanks insomnie. nice one.
but for now i fixed it, even without an extra div...have to check ie and shit now.
cheers!
- insomnie0
Check this out. It works like a charm.
http://talkaboutdesign.com/menu_…