Html Hover子菜单

时间:2018-05-25 04:09:00

标签: html css hover

**如何修复悬停文字填充?实际上当我点击选项3的子菜单时,子菜单对齐到左侧。但是当我在子菜单文本中添加padding: 32px;时,悬停也会显示在填充中。我们如何使填充尼特适用于悬停和填充仅适用于文本**

在应用填充时看看图像,悬停在填充中显示,但我确实想要在填充上应用悬停。只有我想要的文字,如菜单选项1,2,4等。

你能否理解我的问题,请帮忙。 Screenshot



/* BASIC THEME CONFIGURATION */
body {
    color: #797979;
	background: #f6f6f6;
    font-family: 'Ruda', sans-serif;
    padding: 0px !important;
    margin: 0px !important;
    font-size:13px;
}

ul li {
    list-style: none;
}

a, a:hover, a:focus {
    text-decoration: none;
    outline: none;
}
::selection {

    background: #f89611;
    color: #fff;
}
::-moz-selection {
    background: #f89611;
    color: #fff;
}

#container {
    width: 100%;
    height: 100%;
}

/* Bootstrap Modifications */
.modal-header {
	background: #f89611;
}

.modal-title {
	color: white;
}

.btn-round {
	border-radius: 20px;
	-webkit-border-radius: 20px;
}

.accordion-heading .accordion-toggle {
	display: block;
	cursor: pointer;
	border-top: 1px solid #F5F5F5;
	padding: 5px 0px;
	line-height: 28.75px;
	text-transform: uppercase;
	color: #000000;
	background-color: #ffffff;
	outline: none !important;
	text-decoration: none;
}	



/*Theme Backgrounds*/

.bg-theme {
	background-color: #f89611;
}

.bg-theme02 {
	background-color: #ac92ec;
}

.bg-theme03 {
  background-color: #48cfad;
}

.bg-theme04 {
  background-color: #ed5565;
}
/*Theme Buttons*/

.btn-theme {
  color: #fff;
  background-color: #F89611;
  border-color: #48bcb4;
}
.btn-theme:hover,
.btn-theme:focus,
.btn-theme:active,
.btn-theme.active,
.open .dropdown-toggle.btn-theme {
  color: #fff;
  background-color: #48bcb4;
  border-color: #48bcb4;
}

.btn-theme02 {
  color: #fff;
  background-color: #ac92ec;
  border-color: #967adc;
}
.btn-theme02:hover,
.btn-theme02:focus,
.btn-theme02:active,
.btn-theme02.active,
.open .dropdown-toggle.btn-theme02 {
  color: #fff;
  background-color: #967adc;
  border-color: #967adc;
}

.btn-theme03 {
  color: #fff;
  background-color: #48cfad;
  border-color: #37bc9b;
}
.btn-theme03:hover,
.btn-theme03:focus,
.btn-theme03:active,
.btn-theme03.active,
.open .dropdown-toggle.btn-theme03 {
  color: #fff;
  background-color: #37bc9b;
  border-color: #37bc9b;
}

.btn-theme04 {
  color: #fff;
  background-color: #ed5565;
  border-color: #da4453;
}
.btn-theme04:hover,
.btn-theme04:focus,
.btn-theme04:active,
.btn-theme04.active,
.open .dropdown-toggle.btn-theme04 {
  color: #fff;
  background-color: #da4453;
  border-color: #da4453;
}

.btn-clear-g {
	color: #48bcb4;
	background: transparent;
	border-color: #48bcb4;
}

.btn-clear-g:hover {
	color: white;
}

hr {
  margin-top: 20px;
  margin-bottom: 20px;
  border: 0;
  border-top: 1px solid #797979;
}



/*Helpers*/

.centered {
	text-align: center;
}

.goleft {
	text-align: left;
}

.goright {
	text-align: right;
}

.mt {
	margin-top: 25px;
}

.mb {
	margin-bottom: 25px;
}

.ml {
	margin-left: 5px;
	}

.no-padding {
	padding: 0 !important;
}

.no-margin {
	margin: 0 !important;
}

/*Exclusive Theme Colors Configuration*/

.label-theme {
	background-color: #f89611;
}

.bg-theme {
	background-color: #f89611;
}

ul.top-menu > li > .logout {
	color: #fff;
	font-size: 12px;
	border-radius: 4px;
	-webkit-border-radius: 4px;
	border: 1px solid #F89611 !important;
	padding: 5px 15px;
	margin-right: 15px;
	background: #F89611;
	margin-top: 15px;
}


/*sidebar navigation*/

#sidebar {
    width: 210px;
    height: 100%;
    position: fixed;
    background: #E1EEF2;
}

#sidebar h5 {
	color: #f2f2f2;
	font-weight: 700;
}

#sidebar ul li {
    position: relative;
}

#sidebar .sub-menu > .sub li  {
    padding: 0px 0px 0px  0px;
    text-decoration: none;
    
}

#sidebar .sub-menu > .sub li:last-child {
    padding-bottom:10px;
    
    
}

/*LEFT NAVIGATION ICON*/
.dcjq-icon {
    height:17px;
    width:17px;
    display:inline-block;
    background: url("../img/nav-expand.png") no-repeat top;
    border-radius:3px;
    -moz-border-radius:3px;
    -webkit-border-radius:3px;
    position:absolute;
    right:10px;
    top:15px;
}
.active .dcjq-icon {
    background: url("../img/nav-expand.png") no-repeat bottom;
    border-radius:3px;
    -moz-border-radius:3px;
    -webkit-border-radius:3px;
}
/*---*/

.nav-collapse.collapse {
    display: inline;
}

ul.sidebar-menu , ul.sidebar-menu li ul.sub{
    margin: -2px 0 0;
    padding: 0;
}

ul.sidebar-menu {
    margin-top: 75px;
}

#sidebar > ul > li > ul.sub {
    display: none;
}

#sidebar > ul > li.active > ul.sub, #sidebar > ul > li > ul.sub > li > a {
    display: block;
}

ul.sidebar-menu li ul.sub li{
    background: #fff;
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
    
}

ul.sidebar-menu li ul.sub li:last-child{
    border-radius: 0 0 4px 4px;
    -webkit-border-radius: 0 0 4px 4px;
}

ul.sidebar-menu li ul.sub li a {
    font-size: 12px;
    font-weight:500;
    padding: 6px 0;
    line-height: 35px;
    height: 35px;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    transition: all 0.3s ease;
    color: #4D4E4D;
}

ul.sidebar-menu li ul.sub li a:hover {
	color: #fff;
	background: transparent;
	background-color: #4A98D0;
}
ul.sidebar-menu li ul.sub li.active a {
    color:#ff0000;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    transition: all 0.3s ease;
    display: block;
}

ul.sidebar-menu li{
    /*line-height: 20px !important;*/
    margin-bottom: 5px;
    margin-left: 0px;
    margin-right: 0px;
}

ul.sidebar-menu li.sub-menu{
    line-height: 15px;
}

ul.sidebar-menu li a span{
    display: inline-block;
}

ul.sidebar-menu li a{
    color: #555555;
    text-decoration: none;
    display: block;
    padding: 15px 0 15px 10px;
    font-size: 12px;
    font-weight:500;
    outline: none;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

ul.sidebar-menu li a.active, ul.sidebar-menu li a:hover, ul.sidebar-menu li a:focus {
    background: #1B75BC;
    color: #fff;
    display: block;

    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    transition: all 0.3s ease;
}


ul.sidebar-menu li a i {
    font-size: 15px;
    padding-right: 6px;
}
li div{padding-left:20px}
ul.sidebar-menu li a:hover i, ul.sidebar-menu li a:focus i {
    color: #fff;
}

ul.sidebar-menu li a.active i {
    color: #fff;
}


.mail-info, .mail-info:hover {
    margin: -3px 6px 0 0;
    font-size: 11px;
}

<script src="https://mysoftweb2sms.000webhostapp.com/xms/users/users/assets/js/common-scripts.js"></script>

<aside>
          <div id="sidebar"  class="nav-collapse ">
              <!-- sidebar menu start-->
              <ul class="sidebar-menu" id="nav-accordion">
              
              	  <p class="centered"><a href="profile.html"><img src="assets/img/ui-sam.jpg" class="img-circle" width="60"></a></p>
                                 	  	
                  <li class="mt">
                      <a href="dashboard.php">
                          <i class="fa fa-dashboard"></i>
                          <span>Dashboard</span>
                      </a>
                  </li>


                  <li class="sub-menu">
                      <a href="javascript:;" >
                          <i class="fa fa-cogs"></i>
                          <span>Option 1 </span>
                      </a>
                      <ul class="sub">
                          <li><a  href="profile.php">Sub Option 1</a></li>
                          <li><a  href="#">Sub Option 2</a></li>
                        
                      </ul>
                  </li>
                  <li class="sub-menu">
                      <a href="#" >
                          <i class="fa fa-book"></i>
                          <span>Option 2</span>
                      </a>
                    </li>
                  <li class="sub-menu">
                      <a href="javascript:;" >
                          <i class="fa fa-comment"></i>
                          <span>Option 3</span>
                      </a>
                      <ul class="sub">
                          <li><a  href="#">Sub Option 1</a></li>
                          <li><a  href="#">Sub Option 2</a></li>
                        
                      </ul>
                  </li>
                  
                  <li class="sub-menu">
                      <a href="#" >
                          <i class="fa fa-tasks"></i>
                          <span>Option 4</span>
                      </a>
                  </li>
                 
              </ul>
              <!-- sidebar menu end-->
          </div>
      </aside>  
    
   <script src="https://mysoftweb2sms.000webhostapp.com/xms/users/users/assets/js/common-scripts.js">
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

<div>
/* BASIC THEME CONFIGURATION */
body {
    color: #797979;
	background: #f6f6f6;
    font-family: 'Ruda', sans-serif;
    padding: 0px !important;
    margin: 0px !important;
    font-size:13px;
}

ul li {
    list-style: none;
}

a, a:hover, a:focus {
    text-decoration: none;
    outline: none;
}
::selection {

    background: #f89611;
    color: #fff;
}
::-moz-selection {
    background: #f89611;
    color: #fff;
}

#container {
    width: 100%;
    height: 100%;
}

/* Bootstrap Modifications */
.modal-header {
	background: #f89611;
}

.modal-title {
	color: white;
}

.btn-round {
	border-radius: 20px;
	-webkit-border-radius: 20px;
}

.accordion-heading .accordion-toggle {
	display: block;
	cursor: pointer;
	border-top: 1px solid #F5F5F5;
	padding: 5px 0px;
	line-height: 28.75px;
	text-transform: uppercase;
	color: #000000;
	background-color: #ffffff;
	outline: none !important;
	text-decoration: none;
}	



/*Theme Backgrounds*/

.bg-theme {
	background-color: #f89611;
}

.bg-theme02 {
	background-color: #ac92ec;
}

.bg-theme03 {
  background-color: #48cfad;
}

.bg-theme04 {
  background-color: #ed5565;
}
/*Theme Buttons*/

.btn-theme {
  color: #fff;
  background-color: #F89611;
  border-color: #48bcb4;
}
.btn-theme:hover,
.btn-theme:focus,
.btn-theme:active,
.btn-theme.active,
.open .dropdown-toggle.btn-theme {
  color: #fff;
  background-color: #48bcb4;
  border-color: #48bcb4;
}

.btn-theme02 {
  color: #fff;
  background-color: #ac92ec;
  border-color: #967adc;
}
.btn-theme02:hover,
.btn-theme02:focus,
.btn-theme02:active,
.btn-theme02.active,
.open .dropdown-toggle.btn-theme02 {
  color: #fff;
  background-color: #967adc;
  border-color: #967adc;
}

.btn-theme03 {
  color: #fff;
  background-color: #48cfad;
  border-color: #37bc9b;
}
.btn-theme03:hover,
.btn-theme03:focus,
.btn-theme03:active,
.btn-theme03.active,
.open .dropdown-toggle.btn-theme03 {
  color: #fff;
  background-color: #37bc9b;
  border-color: #37bc9b;
}

.btn-theme04 {
  color: #fff;
  background-color: #ed5565;
  border-color: #da4453;
}
.btn-theme04:hover,
.btn-theme04:focus,
.btn-theme04:active,
.btn-theme04.active,
.open .dropdown-toggle.btn-theme04 {
  color: #fff;
  background-color: #da4453;
  border-color: #da4453;
}

.btn-clear-g {
	color: #48bcb4;
	background: transparent;
	border-color: #48bcb4;
}

.btn-clear-g:hover {
	color: white;
}

hr {
  margin-top: 20px;
  margin-bottom: 20px;
  border: 0;
  border-top: 1px solid #797979;
}



/*Helpers*/

.centered {
	text-align: center;
}

.goleft {
	text-align: left;
}

.goright {
	text-align: right;
}

.mt {
	margin-top: 25px;
}

.mb {
	margin-bottom: 25px;
}

.ml {
	margin-left: 5px;
	}

.no-padding {
	padding: 0 !important;
}

.no-margin {
	margin: 0 !important;
}

/*Exclusive Theme Colors Configuration*/

.label-theme {
	background-color: #f89611;
}

.bg-theme {
	background-color: #f89611;
}

ul.top-menu > li > .logout {
	color: #fff;
	font-size: 12px;
	border-radius: 4px;
	-webkit-border-radius: 4px;
	border: 1px solid #F89611 !important;
	padding: 5px 15px;
	margin-right: 15px;
	background: #F89611;
	margin-top: 15px;
}


/*sidebar navigation*/

#sidebar {
   width: 210px;
   height: 100%;
   position: absolute;
   background: #E1EEF2;
top: 0;

}

#sidebar h5 {
	color: #f2f2f2;
	font-weight: 700;
}

#sidebar ul li {
    position: relative;
}

#sidebar .sub-menu > .sub li  {
    padding: 0px 0px 0px  0px;
    text-decoration: none;
    
}

#sidebar .sub-menu > .sub li:last-child {
    padding-bottom:10px;
    
    
}

/*LEFT NAVIGATION ICON*/
.dcjq-icon {
    height:17px;
    width:17px;
    display:inline-block;
    background: url("../img/nav-expand.png") no-repeat top;
    border-radius:3px;
    -moz-border-radius:3px;
    -webkit-border-radius:3px;
    position:absolute;
    right:10px;
    top:15px;
}
.active .dcjq-icon {
    background: url("../img/nav-expand.png") no-repeat bottom;
    border-radius:3px;
    -moz-border-radius:3px;
    -webkit-border-radius:3px;
}
/*---*/

.nav-collapse.collapse {
    display: inline;
}

ul.sidebar-menu , ul.sidebar-menu li ul.sub{
    margin: -2px 0 0;
    padding: 0;
}

ul.sidebar-menu {
    margin-top: 75px;
}

#sidebar > ul > li > ul.sub {
    display: none;
}

#sidebar > ul > li.active > ul.sub, #sidebar > ul > li > ul.sub > li > a {
    display: block;
}

ul.sidebar-menu li ul.sub li{
    background: #fff;
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
    
}

ul.sidebar-menu li ul.sub li:last-child{
    border-radius: 0 0 4px 4px;
    -webkit-border-radius: 0 0 4px 4px;
}

ul.sidebar-menu li ul.sub li a {
    font-size: 12px;
    font-weight:500;
    padding: 6px 0;
    line-height: 35px;
    height: 35px;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    transition: all 0.3s ease;
    color: #4D4E4D;
}

ul.sidebar-menu li ul.sub li a:hover {
	color: #fff;
	background: transparent;
	background-color: #4A98D0;
}
ul.sidebar-menu li ul.sub li.active a {
    color:#ff0000;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    transition: all 0.3s ease;
    display: block;
}

ul.sidebar-menu li{
    /*line-height: 20px !important;*/
    margin-bottom: 5px;
    margin-left: 0px;
    margin-right: 0px;
}

ul.sidebar-menu li.sub-menu{
    line-height: 15px;
}

ul.sidebar-menu li a span{
    display: inline-block;
}

ul.sidebar-menu li a{
    color: #555555;
    text-decoration: none;
    display: block;
    padding: 15px 0 15px 10px;
    font-size: 12px;
    font-weight:500;
    outline: none;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

ul.sidebar-menu li a.active, ul.sidebar-menu li a:hover, ul.sidebar-menu li a:focus {
    background: #1B75BC;
    color: #fff;
    display: block;

    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    transition: all 0.3s ease;
}


ul.sidebar-menu li a i {
    font-size: 15px;
    padding-right: 6px;
}
li div{padding-left:20px}
ul.sidebar-menu li a:hover i, ul.sidebar-menu li a:focus i {
    color: #fff;
}

ul.sidebar-menu li a.active i {
    color: #fff;
}


.mail-info, .mail-info:hover {
    margin: -3px 6px 0 0;
    font-size: 11px;
}

li.sub-menu a:hover{
    padding-left: 32px !important;
}