Aashima Vinayak
Aashima Vinayak

Reputation: 107

Removing white-space in bootstrap

I am trying to create a drop-down but I want to remove the white-space which is coming on hover top and bottom how can I do that? I want to expand that area removing that border on hover

<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>
   
<div class="container">
  <h2>Dropdowns</h2>
  <p>The .divider class is used to separate links in the dropdown menu.</p>                                         
  <div class="dropdown">
    <button class="btn btn-default dropdown-toggle" type="button" id="menu1" data-toggle="dropdown">Tutorials
    <span class="caret"></span></button>
    <ul class="dropdown-menu" role="menu" aria-labelledby="menu1">
      <li role="presentation"><a role="menuitem" tabindex="-1" href="#">W3Schools</a></li>
      <li role="presentation" class="divider"></li>
      <li role="presentation"><a role="menuitem" tabindex="-1" href="#">HTML</a></li>
      <li role="presentation"><a role="menuitem" tabindex="-1" href="#">CSS</a></li>
      <li role="presentation" class="divider"></li>
      <li role="presentation"><a role="menuitem" tabindex="-1" href="#">About Us</a></li>
    </ul>
  </div>
</div>

Upvotes: 1

Views: 2960

Answers (3)

Nitesh
Nitesh

Reputation: 15779

To remove the white-space from the navigation, you need to make the below CSS Changes.

CSS Changes:

.dropdown-menu {
    padding: 0px;
    margin: 0px;
    line-height: normal;
}
.dropdown-menu li, .dropdown-menu a {
    padding: 0px;
    margin: 0px;
    line-height: normal;
}
.dropdown-menu a {
    padding: 10px;
}

LIVE DEMO

Hope this helps.

PS: Values are used for illustrative purposes. You can change them as per your requirements.

Upvotes: 1

G.L.P
G.L.P

Reputation: 7217

try like this: Demo

.dropdown-menu > li > a {
    padding:0 20px !important;
}
.dropdown-menu .divider {
    margin:0;
}

Upvotes: 0

stanze
stanze

Reputation: 2480

Add the below styles

.dropdown-menu .divider{
    margin: 0;
}
.dropdown-menu{
    padding: 0;
}

Upvotes: 1

Related Questions