Skip to main content
Inspiring
February 20, 2021
Answered

Using pseudo elements with list items

  • February 20, 2021
  • 2 replies
  • 380 views

Hi everyone,

 

Is there a way to stop the text from wrapping under a pseudo-element when used with list items? In the example provided, you see how the text, in all but the first line, wraps under the pseudo-element. I would like to have the text align under the first character (red line). Nothing I've tried has worked thus far. Any help would be very much appreciated.

 

Kind regards,

 

Mark

This topic has been closed for replies.
Correct answer Ben M

For the ul tag of your list you can set the value ( list-style-position: outside; ) and that should keep the text from wrapping underneath. You can see it in action here: https://www.w3schools.com/cssref/pr_list-style-position.asp .  If you have a question about implementing this within your specific page we will need to see the code.

2 replies

Nancy OShea
Community Expert
Community Expert
February 20, 2021

A correctly formed list will line up correctly without any extra help. So either your HTML is malformed or something in your CSS code is messing things up.  See screenshot of an ordinary unordered list in Code / Live view.  Note: no code errors present as denoted by the green checkmark in a circle.

 

 

If you still need help, upload your page to a remote server and post the URL.

 

 

 

Nancy O'Shea— Product User & Community Expert
Inspiring
February 22, 2021

Thanks so much. I was able to correct it using list-style-position: outside.

 

Kind regards,

 

Mark

Ben MCommunity ExpertCorrect answer
Community Expert
February 20, 2021

For the ul tag of your list you can set the value ( list-style-position: outside; ) and that should keep the text from wrapping underneath. You can see it in action here: https://www.w3schools.com/cssref/pr_list-style-position.asp .  If you have a question about implementing this within your specific page we will need to see the code.