Greg
Greg

Reputation: 3063

Apply LI style to a specific part of the site only

I'd like to give a specific style (ie. padding 10px and bullet points) to my LI items only when they are inside <div class="article-content"> How could I do that without interfering with the specific ul/li styles in place on my website (navigation menu, etc.) Many thanks

.article-content {
  border-bottom: 0px;
    float: left;
  clear: both;
  width: 100%;
  margin-top: 10px;
  padding-right: 10px;
  padding-bottom: 30px;
  padding-left: 10px;
    text-align: justify;
  letter-spacing: 1px;
  color: #1a1a1a;

}

HTML

<p>Blablabla:</p>
        <p> Blablabla </p>
        <ul>
          <li>dfdd</li>
          <li>dfsdf</li>
          <li>dsf</li>

Upvotes: 0

Views: 50

Answers (3)

codeee
codeee

Reputation: 397

Please follow below structure of HTML and Add CSS given below :

HTML :

<div class="article-content">
<p>Blablabla:</p>
        <p> Blablabla </p>
        <ul>
          <li>dfdd</li>
          <li>dfsdf</li>
          <li>dsf</li>
        </ul>
</div>

CSS :

.article-content {
border-bottom: 0px;
float: left;
clear: both;
width: 100%;
margin-top: 10px;
padding-right: 10px;
padding-bottom: 30px;
padding-left: 10px;
text-align: justify;
letter-spacing: 1px;
color: #1a1a1a;

}
.article-content ul
{
 list-style:disc;
 padding-left:10px;
}

Result:

enter image description here

Upvotes: 1

J Prakash
J Prakash

Reputation: 1333

CSS :

.article-content ul li {
     padding: 10px;
     list-style-type:circle;
}

I think this should work for you.

Upvotes: 3

Suresh Ponnukalai
Suresh Ponnukalai

Reputation: 13998

Specify your selector infront of ul and li.

.article-content ul
{
  /*Your style goes here*/
}
.article-content ul li
{
  /*Your style goes here*/
}

Upvotes: 1

Related Questions