Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8093695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:33:22+00:00 2026-06-05T20:33:22+00:00

CSS I have some simple CSS to apply a negative text-indent value on the

  • 0

CSS

I have some simple CSS to apply a negative text-indent value on the li in an ul:

<style type="text/css">
    ul.indent li { text-indent: -20px; padding-left: 20px; }
</style>

<!--[if lte IE 8 ]>
<style type="text/css">
    ul.indent li { text-indent: -20px; padding-left: 0; margin-left: 20px; }
</style>
<![endif]-->

Since Internet Explorer 8 and lower deal with list item margins and padding differently than modern browsers, I’m using a conditional comment for IE8 and below to apply different padding and margin values. (Side note: If anyone knows of a universal, cross-browser CSS solution to get consistent margins/padding without using conditional comments, I’m all ears. I need to support IE6 and up, Chrome, Firefox, Safari, and Opera.)

HTML

This is my HTML:

<ul>
    <li>Lorem ipsum...</li>
</ul>

<ul class="indent">
    <li>Lorem ipsum...</li>
</ul>

The first list is completely unstyled (as a control for the experiment), and the second list uses the CSS class defined above (class="indent").

The result

Here’s the problem: The HTML/CSS above produces a consistent result in every browser except IE8. This is what I’m seeing in the browsers:

All browsers vs. IE8

I see what’s on the left side in IE6, IE7, IE9, Chrome, Firefox, Safari, and Opera.

I see what’s on the right side in IE8. Notice the area highlighted in red. As soon as a negative text-indent value is added to the CSS, IE8 seems to throw a bunch of extra pixels between the list item bullet and the list item text.

How can I prevent IE8 from adding those extra pixels?

You can see the code in action here: http://jsfiddle.net/Kxb8v/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:33:24+00:00Added an answer on June 5, 2026 at 8:33 pm

    UL and LI elements are block level elements… that’s probably why its unpredictable on a browser level. How about wrapping that text in a p tag and then applying the text-indent since it’s not intended for block level elements.

    <style type="text/css">
        .indent { text-indent: -20px; padding-left: 20px; }
    </style>
    
    
    <ul>
        <li><p class="indent">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce venenatis mi sit amet mauris varius ut viverra magna eleifend. Aliquam viverra, magna sed mollis adipiscing, libero mi adipiscing ante, ut hendrerit lacus leo id elit. Nulla commodo mi nec nulla ornare congue.</p></li>
    </ul>
    

    EDIT

    So just in case my response was unclear… list items are used for a number of things besides containing text. Some sites use them for layout. List items also have padding and properties like list-style which allow you to control the image used for each list item.

    So with that being known, it would seem that asking a list item to text-indent could be handled a couple ways. You could indent any containing text or maybe the indent is referring to the list item itself, including the image 😉 I bet this decision is left up to the browser and therefore is subject to be handled differently between versions.

    Hope that helps to clarify where I was going with that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have HTML + CSS text. I need some lib with simple function like
I have some very simple HTML: <div id=advisor> <div id=print_this_container> <form> <input type=button value=
I have an anchor tag with some simple CSS: div { background-color: gray; /*
I have some CSS style that does not work in IE and that works
I have a simple website(primarily static html/css) but for some reason some of the
I have a project that I am working on for some simple CSS buttons,
I have set up an HttpHandler for *css to do some simple parsing: <handlers>
I have some CSS and HTML for horizontal tabs that works perfectly in jsfiddle.
I have some CSS that doesn't behave correctly with IE8. It works fine with
I have some css files that i need to use in RTL direction template.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.