Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing border-radius in Bootstrap 4 | list-group-item

I am new to bootstrap and have been over riding bootstrap border-radius property with my custom CSS class.

.border-radius-none{
    border-radius: 0;
}

Image:

enter image description here

This does work for all the cases but while over riding list-group-item, first and last element are not over ridden.

  1. My main css is linked below the bootstrap css.(As in below snippet)
  2. Read article on CSS specificity, which doesn't help me out.

Things I tried

  1. Added !important to my css.

Is there any other way to remove bootstrap border-radius default value, without using important ?

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB"
    crossorigin="anonymous">
<link href="./Main.css" rel="stylesheet">


<li class="list-group-item bg-black white-text border-none">
    <div class="row">
        <div class="col-9"> Latest Jobs </div>
        <div class="col-3">
            <a href="#" class="mr-auto">View all</a>
        </div>


    </div>
</li>
like image 275
Akshay L Avatar asked Jun 04 '18 12:06

Akshay L


People also ask

How will you remove the border from the top of a div using Bootstrap class?

Use the border-top-0 class to remove the top border from an element.

Which Bootstrap 4 class can be used to make a borderless table?

Add .table-borderless for a table without borders.

Which Bootstrap 4 class is used to add rounded corners to an image select one?

img-rounded − You can make rounded corners to an image by using . rounded class.

How do I make rounded corners in Bootstrap?

<div class="img-rounded"> will give you rounded corners.


2 Answers

Some of the class are predefined in bootstrap as per the documentation class="rounded-0" which will set border-radius to 0

https://getbootstrap.com/docs/4.0/utilities/borders/#border-radius

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/>
 <div class="container-fluid">
   <ul class="list-group">
     <li class="list-group-item rounded-0">Cat</li>
     <li class="list-group-item rounded-0">Dog</li>
     <li class="list-group-item rounded-0">Rabbit</li>
     <li class="list-group-item rounded-0">Alpaca</li>
   </ul>
 </div>
like image 166
Nilesh Naik Avatar answered Oct 21 '22 22:10

Nilesh Naik


Add this class to your css to override .list-group-item or .list-group-item:last-child and place the link to your css after the boostrap css link

    .list-group-item{
                border-radius: 0;
     }

or

.list-group-item:last-child{
                border-radius: 0;
     }
like image 34
Friday Ameh Avatar answered Oct 21 '22 23:10

Friday Ameh