How to select text within li using css [duplicate]


Tags: css

Problem :

This question already has an answer here:

I have following HTML markup enter image description here

How do i select text inside this

  • As you can see inside that

  • there is a div i dont want to affect contents on that div.



  • Solution :

    You can't select only that text. So style the div too:

    ul,
    li div {
      color: black;
    }
    li {
      color: green;
    }
    <ul>
      <li>
        Text
        <div>Div Text</div>
      </li>
      <li>
        Text
        <div>Div Text</div>
      </li>
    </ul>


      CSS Howto..

      How to only change left padding in javafx css

      how do i align contact form 7 next to text

      How to invoke a “tooltip” when hovering over ID'd HTML elements in a Browser?

      How can I set a CSS property on the html element with jQuery?

      How to hide overflow characters of a div when resizing [duplicate]

      How do I hide the items within a menu until a click event?

      Show-hide based on two sets of selectors--how to make them work together?

      How to scroll to bottom of div generated by ng-repeat Angular JS using JQuery?

      How to create this image using CSS?

      How to simplify cross-browsing css animation keyframe?

      How to read this LESS css?

      How to use Aural CSS?

      How might I get an element's border color value using jQuery?

      How to crop and design these images like this using html and css? [closed]

      How to add next / previous buttons to Surface tablet touch-slideshow?

      How to use min-width for “float:right” element in CSS?

      How to draw scalable rectangles Ruby on Rails

      How to replace with a
      filled with CSS?

      continue with same Show and hide divs when we change page

      How to reffer in CSS to an input which has class attached to?

      How do I modify this script to use different colors?

      How can I get this CSS to display properly in IE8?

      How do I fix hover property of a div?

      how to make this “div” always visible to users

      How to align images in a mosaic style? html/css

      How to prevent page jump when using # href to swap gallery images using a div ID?

      css rules multi class, how to match two out of many

      How to make application browser compatible

      How do I change the css of a different element on hover?

      How to use @RenderPage to include CSS content inline - MVC Razor