sarvu_don37
sarvu_don37

Reputation: 53

Why is padding not being applied on the list item element?

This is my html code:

<ul class="price-card__feature-list">
                <li class="price-card__feature-item">500 GB Storage</li>
                <li class="price-card__feature-item">2 Users Allowed</li>
                <li class="price-card__feature-item">Send up to 3 GB</li>
</ul>

This is my scss code:

.price-card{
    padding: 2rem;
    border-radius: 5px;
    box-shadow: 0 .1rem .4rem rgba(#333, 0.2);
    color: $col-txt-med;

    &__feature-list{
        list-style: none;
    }

    &__feature-item{
        display: block;
        width: 90%;
        font-weight: 600;
        margin: 0 auto; 
        padding: 2rem auto 2rem;
        border-bottom: 1px solid rgba(#666, .2);
    }
}

If compiled to css :


.price-card{
    padding: 2rem;
    border-radius: 5px;
    box-shadow: 0 .1rem .4rem rgba(#333, 0.2);
    color: $col-txt-med;   
}

.price-card__feature-list{
    list-style: none;
}

.price-card__feature-item{
        display: block;
        width: 90%;
        font-weight: 600;
        margin: 0 auto; 
        padding: 2rem auto 2rem;
        border-bottom: 1px solid rgba(#666, .2);
}

What I want is the effect in which every list item is followed by a line which looks like an hr element. I tried to achieve this using border property. But now I am facing trouble with padding.

Upvotes: 1

Views: 519

Answers (1)

Johannes
Johannes

Reputation: 67748

Your padding and border settings contained invalid values ("auto" for padding and the hex color value for rgba in border-bottom)

.price-card {
  padding: 2rem;
  border-radius: 5px;
  box-shadow: 0 .1rem .4rem rgba(#333, 0.2);
  color: $col-txt-med;
}

.price-card__feature-list {
  list-style: none;
}

.price-card__feature-item {
  display: block;
  width: 90%;
  font-weight: 600;
  margin: 0 auto;
  padding: 2rem 0;
  border-bottom: 1px solid rgba(100,100,100, 0.2);
}
<ul class="price-card__feature-list">
  <li class="price-card__feature-item">500 GB Storage</li>
  <li class="price-card__feature-item">2 Users Allowed</li>
  <li class="price-card__feature-item">Send up to 3 GB</li>
</ul>

Upvotes: 1

Related Questions