- This topic is empty.
-
AuthorPosts
-
January 3, 2016 at 1:49 am #236319
artlessink
ParticipantHow would I wrap to elements using css.
For example, lets say I have a ul with 9 list items
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
How would I wrap li 6,7, and 8 using css, so they appear on the same line?
January 3, 2016 at 3:46 am #236320Paulie_D
MemberIf by ‘wrap’ you mean “enclose in another element”…you can’t do that with CSS.
You can change the layout though for specific list items…
http://codepen.io/Paulie-D/pen/LGxzPY
Frankly, I can’t think of a use case for this…are you trying to do some kind of submenu? If so, you’re going about it the wrong way.
January 3, 2016 at 11:43 am #236355artlessink
ParticipantYes that’s exactly correct. I’m looking at making un ordered list items equidistant.
January 3, 2016 at 1:31 pm #236369Paulie_D
MemberI’m looking at making unordered list items equidistant.
Sorry that’s not very clear and I’m struggling to see the relevance to your original request.
Are you saying that 7 & 8 will be submenu items to 6?
Do you have an image of what it is you are trying to do?
January 3, 2016 at 1:41 pm #236370artlessink
ParticipantNo they will be forma elements in fact we can make them all p tags. I’m not certain what type of container would be best but my goal is to make them all equadistant. So the element 1 will stretch the full lenght allowed and will be equal in lenght to 6,7,8, eqully spaced.
January 3, 2016 at 3:20 pm #236376Paulie_D
MemberReally need to see an image of what your trying to do here.
January 3, 2016 at 3:28 pm #236377Paulie_D
MemberOf course flexbox can do this..
http://codepen.io/Paulie-D/pen/QydQXo
But you could probably do the same thing with floats…
January 5, 2016 at 3:56 am #236409srisri
ParticipantYou can use the below code:
li:nth-child(6) a, li:nth-child(7) a {
float: left;
}January 5, 2016 at 5:46 am #236412Paulie_D
MemberWhich is what I said…
But you could probably do the same thing with floats…
January 5, 2016 at 4:30 pm #236430artlessink
ParticipantAwesome these are both great answers. Flex-box is amazing. just not enough support for it before IE 10. How would I use floats to make the elements equidistant?
January 6, 2016 at 12:14 am #236434Paulie_D
MemberDepends on what you mean by equidistant…I’ve generally interpreted that to me “the same size” but that’s not what it actually means of course.
Are you suggesting that these might be different sizes?…that would be harder…probably.
To be honest…it would really help if we knew what this was supposed to look like…do you have a design image we could look at?
January 9, 2016 at 7:15 pm #236560artlessink
Participanthttp://codepen.io/artlessink/pen/LGyqvE
I’ve uploaded an example here.
I’m using floats here but there not equidistant.
The form elements do not start and end at the same point.January 10, 2016 at 3:53 am #236563Paulie_D
MemberOK….I’m going to ask the obvious question here.
Why are all the elements in the same container?
Why not break this up into logical rows? It would be much easier…
January 10, 2016 at 12:10 pm #236573artlessink
ParticipantWhat would be the best way to do so,
January 10, 2016 at 12:47 pm #236575Paulie_D
MemberIf you need elements in a row, create a div to hold them….it’s basic layout.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.