Add a bottom border to a div

You have to specify the border-bottom-style also to the div

and your code becomes

.divLast 
{
   top: 0px;
   margin:0px;  
   padding: 0px 2px 2px 3px;    
   border-width: 2px;
   border-bottom-width:2px;
   border-bottom-color:White;
   border-bottom-style: solid;
   width: 100%;
}

or you can use a shorthand for the border-bottom like below

<style>
.divLast 
{
   top: 0px;
   margin:0px;  
   padding: 0px 2px 2px 3px;    
   border-width: 2px;
   border-bottom: 2px white solid;
   width: 100%;
}
</style>
<div class='divLast'>
   test element with white border bottom
</div>

This works fine for me


It's because you need to state what the border style is. Without this the border wont show:

border-bottom-style:solid;

You could also combine your declerations into one like so:

border-bottom:2px solid White;

Tags:

Css