0

I've got a list item which has these elements :

  • First item
  • Another list item
  • Sand, Gravel, Clay, and Ceramic and Refractory Minerals Mining and Quarrying materials

And I want them to look they do look above in this question all in one line or if the item gets too big break it nicely like this :

  • Sand, Gravel, Clay, and Ceramic and Refractory Minerals Mining and Quarrying materials big name which is aligning nicely

But instead my items look like this(screen shot) :

enter image description here

As you can see it doesn't look good. This is my html structure :

<ul class="something">
  <li>
     <div style="width:auto; display:inline-block;">
       <span>This is where super long text goes text goes</span>
     </div>
  </li>
</ul>

ul and li don't have any style on them just those inherited from bootstrap css.

Which css do I use so that my list from the screen shot looks like the first one in this question?

5 Answers 5

1
<ul class="something">
  <li>
       This is where super long text goes text goes
  </li>
</ul>
Sign up to request clarification or add additional context in comments.

2 Comments

Hi Joris, I can't do that as we're using plugin which puts the div around my span element
jsfiddle.net/8hfgR - or is it also impossible to change the inline styles?
0

Just add

ul.something li div {vertical-align: top}

and it should work as you want it to.

Comments

0

If you want horizontal lists, use the following CSS:

li{display:inline;}

Comments

0

Put this on your stylesheet:

.something li div{display:inline;}

Comments

0

Try this: In your code display:inline-block is breaking the list. So try after removing that

<ul >
  <li><div style="width:auto; "><span>First item</span></div></li>
  <li><div style="width:auto;"><span>Another list item</span></div></li>
 <li><div style="width:auto;"><span>Sand, Gravel, Clay, and Ceramic and Refractory Minerals Mining and Quarrying materials</span></div></li>
</ul>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.