Member 11859517 Ответов: 1

Droup down menu добавление к главному меню в css.


привет,

Я создаю горизонтальное меню с помощью CSS для. Он прекрасно работает без какого-либо меню droup down.
Когда я писал css для выпадающего меню, его добавление в мое главное меню вместо того, чтобы спускаться вниз как выпадающее меню.
Пожалуйста, кто-нибудь помогите, чего мне не хватает. плзз.
Ниже мой код HTML
<div id="talltabs-maroon">
            <ul>
                <li class='@Html.IsActive("Home", "Index")'>
                    <a href=@Url.Action("Index", "Home")>
                        <span class="glyphicon glyphicon-random"></span>
                        @**@
                        <p>Analog<span> Signal</span></p>
                    </a>
                </li>
                <li>
                    <a href=@Url.Action("Index", "Home")>
                        <span class="glyphicon glyphicon-signal"></span>
                        <p>Digital <span>Signal</span></p>
                    </a>
                </li>
                <li class='@Html.IsActive("Home", "SignalDataView")'>
                    <a href=@Url.Action("SignalDataView", "Home")>
                        <span class="glyphicon glyphicon-list"></span>
                        <p>Signal Data View</p>
                    </a>
                </li>
                <li class='@Html.IsActive("Home", "SignalDataReView")'>
                    <a href=@Url.Action("SignalDataReView", "Home")>
                        <span class="glyphicon glyphicon-search"></span>
                        <p>Signal Data Review</p>
                    </a>
                </li>
                <li class='@Html.IsActive("Home", "IOSignalList")'>
                    <a href=@Url.Action("IOSignalList", "Home")>
                        <span class="glyphicon glyphicon-stats"></span>
                        <p>IO Status</p>
                    </a>
                </li>
                <li class='@Html.IsActive("Home", "IOSignalList")'>
                    <a href=@Url.Action("IOSignalList", "Home")>
                        <span class="glyphicon glyphicon-list-alt"></span>
                        <p>IO Signal List</p>
                    </a>
                </li>
                <li class="dropdown @Html.IsActive("Certificate", "Index")">
                    <a href=@Url.Action("IOSignalList", "Home") class="dropbtn" style="margin-bottom:0px;">
                        <span class="glyphicon glyphicon-certificate"></span>
                        <p>
                        Certificates
                            
                        </p>
                    </a>
                    <ul class="dropdown-content" style="top:100px; left:0">
                        <li>
                            <a href=@Url.Action("Valve", "Report")>
                                
                                <p>Valve Report</p>
                            </a>
                        </li>
                        <li>
                            <a href=@Url.Action("Valve", "Report")>
                                
                                <p>Cylinder Report</p>
                            </a>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>

ниже приведены css для главного меню
#talltabs-maroon {
    clear: left;
    float: left;
    padding: 0;
    border-top: 3px solid #CD324F;
    width: 100%;
    overflow: hidden;
    font-family: Georgia, serif;
    height: 90px;
    position: inherit;
}

    #talltabs-maroon ul {
        float: left;
        margin: 0;
        padding: 0;
        list-style: none;
        position: relative;
        left: 50%;
        text-align: center;
    }

        #talltabs-maroon ul li {
            display: block;
            float: left;
            list-style: none;
            margin: 0;
            padding: 0;
            position: relative;
            right: 50%;
        }

            #talltabs-maroon ul li a {
                display: block;
                float: left;
                margin: 0 3px 0 0;
                padding: 0px 10px 6px 10px;
                background: #CD324F;
                text-decoration: none;
                color: #fff;
            }

                #talltabs-maroon ul li a p:hover {
                    color: aqua;
                }

                #talltabs-maroon ul li a:hover {
                    padding: 20px 10px 6px 10px;
                    color: black
                }

            #talltabs-maroon ul li.active a,
            #talltabs-maroon ul li.active a:hover {
                padding: 25px 10px 6px 10px;
                border-width: 5px;
                border-color: aqua;
                color: aqua;
            }


Что я уже пробовал:

вот мое droup down menu css
.dropbtn {
    list-style-type: none;
    color: white;
    padding: 14px;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

.dropdown {
    position: relative;
    display: block;
}

.dropdown-content {
    list-style-type: none;
    display: none;
    position: absolute;
    right: 0;
    /*background-color: black;*/
    background-image: url('../../Images/black-olive.jpg'); /*dropdowm popup*/
    min-width: 160px;
    box-shadow: 0px 8px 16px 5px rgba(0,0,0,0.2);
    z-index: 1;
    padding-right: 2px;
    margin-right: 2px;
}

    .dropdown-content a {
        color: white;
        padding: 10px 14px;
        text-decoration: none;
        display: block;
    }

        .dropdown-content a:hover {
            /*background-color: gray;*/
            color: black;
        }

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown:hover .dropbtn {
    /*background-color: #3e8e41;*/
}

j snooze

глядя на это может быть вам полезно
https://www.w3schools.com/howto/howto_css_dropdown.asp

1 Ответов

Рейтинг:
0

aniruddh kadia

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
#talltabs-maroon {
	/*clear: left;
    float: left;*/
	padding: 0;
	border-top: 3px solid #CD324F;/*width: 100%;
    overflow: hidden;
    font-family: Georgia, serif;
    height: 90px;
    position: inherit;*/
}
   #talltabs-maroon ul {
	float: left;
	margin: 0;
	padding: 0;
	list-style: none;
	position: relative;/*left: 50%;
        text-align: center;*/
}
   #talltabs-maroon ul a {
	display: block;
	color: #333;
	text-decoration: none;
	font-weight: 700;
	font-size: 12px;
	/*line-height:32px;*/
	padding: 0 15px;
}
#talltabs-maroon ul li {
	/*display: block;*/
	float: left;
	/*list-style: none;*/
	margin: 0;
	/*padding: 0;*/
	position: relative;
	/*right: 50%;*/
	padding: 0px 20px;
	list-style: none;
}
#talltabs-maroon ul li a {
	text-decoration: none;
}
   #talltabs-maroon ul li.current-menu-item {
	background: #ddd
}
#talltabs-maroon ul li:hover {
	background: #f6f6f6
}
#talltabs-maroon ul ul {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	background: #fff;
	padding: 0
}
#talltabs-maroon ul ul li {
	float: none;
	width: 100%;
	margin: 1px 0px;
	padding: 0px 5px;
}
#talltabs-maroon ul ul a {
	/*line-height:120%;*/
	padding: 5px
}
#talltabs-maroon ul ul ul {
	top: 0;
	left: 100%
}
#talltabs-maroon ul li:hover > ul {
	display: block
}
</style>
</head>

<body>
<div id="talltabs-maroon">
  <ul>
    <li class='@Html.IsActive("Home", "Index")'> <a href=@Url.Action("Index", "Home")> <span class="glyphicon glyphicon-random"></span> @**@
      <p>Analog<span> Signal</span></p>
      </a> </li>
    <li> <a href=@Url.Action("Index", "Home")> <span class="glyphicon glyphicon-signal"></span>
      <p>Digital <span>Signal</span></p>
      </a> </li>
    <li class='@Html.IsActive("Home", "SignalDataView")'> <a href=@Url.Action("SignalDataView", "Home")> <span class="glyphicon glyphicon-list"></span>
      <p>Signal Data View</p>
      </a> </li>
    <li class='@Html.IsActive("Home", "SignalDataReView")'> <a href=@Url.Action("SignalDataReView", "Home")> <span class="glyphicon glyphicon-search"></span>
      <p>Signal Data Review</p>
      </a> </li>
    <li class='@Html.IsActive("Home", "IOSignalList")'> <a href=@Url.Action("IOSignalList", "Home")> <span class="glyphicon glyphicon-stats"></span>
      <p>IO Status</p>
      </a> </li>
    <li class='@Html.IsActive("Home", "IOSignalList")'> <a href=@Url.Action("IOSignalList", "Home")> <span class="glyphicon glyphicon-list-alt"></span>
      <p>IO Signal List</p>
      </a> </li>
    <li class="dropdown @Html.IsActive("Certificate", "Index")"> <a href=@Url.Action("IOSignalList", "Home") class="dropbtn" style="margin-bottom:0px;"> <span class="glyphicon glyphicon-certificate"></span>
      <p> Certificates </p>
      </a>
      <ul class="dropdown-content">
        <li> <a href=@Url.Action("Valve", "Report")>
          <p style="margin: 0px;">Valve Report</p>
          </a> </li>
        <li> <a href=@Url.Action("Valve", "Report")>
          <p style="margin: 0px;">Cylinder Report</p>
          </a> </li>
      </ul>
    </li>
  </ul>
</div>
</body>
</html>