Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to dynamically size a <ul> with jQuery? Re: How to dynamically size a

    with jQuery?

#59384
asp
Participant

Hi!

I made this using plain CSS.

HTML:

Code:



Test

  • content1

  • content2

  • content3


and the CSS:

Code:
#wrapper {
position:absolute;
left:0px;
top:0px;
width:100%;
height:100%;
padding:0px;
z-index:0;
}

#main {
height:100%;
margin:2.6em;
background-color:#009900;
}

ul {
margin:0px;
padding:0px;
}

.box {
list-style:none;
float:left;
width:27%;
height:auto;
margin-left:3%;
margin-right:3%;
background-color:#0066FF;
}

I used a wrapper around, and then inside it is the main div, that’s 100% width but with 2.6em in margin.
The boxes are using a width of 27%, its not 33% as you’ll expect because the margin has to have some space, and that’s the problem. The margin on the boxes is not constantly 2.6em. I hope you’ll find out of it, this is the best I could do for now.