gpt4 book ai didi

html - 如何减小下拉菜单的宽度

转载 作者:行者123 更新时间:2023-11-28 04:51:29 25 4
gpt4 key购买 nike

我正在开发一个网站,其中我有一个网站模板,下拉菜单的宽度已满,我怎样才能将宽度减小到主标题的大小。我已经输入了显示代码页面和 html 页面中使用的 css 脚本也在下面输入。请帮助将下拉菜单的宽度减小到精确的标题框大小。

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Menu</title>
<link href="ddmenu/ddmenu.css" rel="stylesheet" type="text/css" />
<script src="ddmenu/ddmenu.js" type="text/javascript"></script>
<style>
/*The following are for this demo page only (not required for the ddmenu).*/
body { background: #eee url(loginpage1.jpg) no-repeat center 0px; padding-top:90px;}
</style>
</head>
<body>
<nav id="ddmenu">

<ul>
<li class="full-width">
<span class="top-heading">bguge</span>
<i class="caret"></i>
<div class="dropdown">
<div class="dd-inner">
<ul class="column">
<li><h3>hwehwieo</h3></li>
<li><a href='hgh.php'>gnehgiwe</a></li>
<li><a href='disuests.php'>ghgowgh</a></li>
</ul>

</div>
</div>
</li>
<li class="full-width">
<span class="top-heading">bgwegh</span>
<i class="caret"></i>
<div class="dropdown">
<div class="dd-inner">
<ul class="column">
<li><h3>ghurghoi</h3></li>
<li><a href="sasgru.php">ghg</a></li>
<li><a href="#">Completed</a></li>
</ul>

</div>
</div>
</li>
<li class="full-width">
<span class="top-heading">hwegho</span>
<i class="caret"></i>
<div class="dropdown">
<div class="dd-inner">
<ul class="column">
<li><h3>UPDATES</h3></li>
<li><a href="updatestatusinput.php">REMARKS</a></li>
<li><a href="#">completed</a></li>
</ul>

</div>
</div>
</li>
<li class="full-width">
<span class="top-heading">SEARCH</span>
<i class="caret"></i>
<div class="dropdown">
<div class="dd-inner">
<ul class="column">
<li><a href="termsimple.php">SEARCH</a></li>
</ul>

</div>
</div>
</li>
<li class="full-width">
<span class="top-heading">APPROVALS</span>
<i class="caret"></i>
<div class="dropdown">
<div class="dd-inner">
<ul class="column">
<li><a href="aroval.php">PENDING APPROVALS</a></li>
</ul>

</div>
</div>
</li>
<li class="full-width">
<li><a href="index.php">LOGOUT</a></li>
</li>
</ul>
</nav>
</body>
</html>
and the css scripts are
#ddmenu
{
display:block;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
text-align:center; /*Specify the alignment of the whole UL if UL is not width:100%;*/
letter-spacing:normal;
}

#ddmenu ul
{
margin:0 auto;
padding:0;
text-align:center; /* Alignment of each top-level menu items within the UL */
width:100%;
font-size:0;
background:#1C456E;
display:inline-block;
list-style:none;
position:relative;
z-index:999999990;
max-width:1400px;
border:1px solid rgba(255,255,255,0.2);
border-radius:4px;
}

#ddmenu li
{
margin:0;
padding:0;
font-size:16px;
display:inline-block;
*display:inline;
zoom:1; /*for IE6-7*/
position:relative;
color:#eee;
line-height:46px; /*This determines the height of the menu*/
vertical-align:middle;
transition:background-color 0.2s;
outline:none;
-moz-user-select:none;
-webkit-user-select: none;
-ms-user-select: none;
}

#ddmenu .full-width {
position: static;
}

#ddmenu .over
{
color:#FFF;
background-color:#205081;
}

#ddmenu .over.no-sub {

}

#ddmenu .top-heading
{
font-weight:bold;
margin:0 16px;
color:inherit;
text-decoration:none;
display:inline-block;
outline:0;
cursor:pointer;
}

/* links of top-heading */
#ddmenu a, #ddmenu a:link, #ddmenu a:hover
{
color:inherit;
}
#ddmenu a:hover
{
text-decoration:underline;
}

#ddmenu a:focus
{
outline:1px dotted #09F;
}

/* caret(arrow icon) */
#ddmenu .caret
{
color:inherit;
left:-12px;
width: 0;
height: 0;
overflow:hidden;/*for IE6*/
vertical-align:middle;
margin-bottom:2px;
border-top: 4px solid;/*caret size is 4px now*/
border-right: 4px solid transparent;
border-left: 4px solid transparent;
display: inline-block;
position:relative;
}

/* sub-menu layout
----------------------------*/

#ddmenu .dropdown
{
width:auto;
left:0px;
color:#000;
padding:0;margin:0;display:none;position:absolute;overflow:hidden;
top:100%;
border:1px solid rgba(255,255,255,0.35);
border-top:none;
border-radius:2px;
background-color:rgba(0,0,0,0.2);
background-color:#ccc \9;/*fallback for old IE*/
}

#ddmenu .full-width .dropdown {
width:100%;
padding:0;
margin:0;
}

#ddmenu .offset300 {
left:-300px;right:auto;
}

#ddmenu .right-aligned {
left:auto;
right:0px;
}

#ddmenu .over .dropdown
{
display:block;
}

#ddmenu .dd-inner {
text-align:center;
padding:20px;
margin:16px;
background-color:#FFF;
white-space:nowrap;
font-size:13px;
}

#ddmenu ul ul
{
margin:0;padding:0;text-align:left;width:auto;background:none;border:none;display:block;position:static;z-index:0;border-radius:0;
}

#ddmenu ul ul li
{
font-size:13px;
padding:6px 0; /*It determines the line height*/
color:inherit;
line-height:1;
margin:0;display:block;position:static;background:none;border:none;transition:none;border-radius:0;
}

/* links in sub menu
----------------------------*/

#ddmenu .dropdown a
{
color:#000;
line-height:1;
text-decoration:none;
transition:color 0.4s;
}

#ddmenu .dropdown a:hover, #ddmenu .dropdown a:focus
{
text-decoration:none;
color:#09F;
}

/* blocks within the sub-menu
-----------------------------*/
#ddmenu .column
{
text-align:left;
vertical-align:top;/*or middle*/
display:inline-block;
*display:inline;*zoom:1;
white-space:normal;
width:auto;min-width:200px;
padding:0 30px;
border-right:1px solid #999;
}

#ddmenu .dd-inner ul:last-child
{
border-right:none;
}

#ddmenu h3 {
font-weight: 500;
line-height: 1.1;
margin-top: 12px;
margin-bottom: 8px;
font-size: 24px;
}

enter code here

#ddmenu div.column h3 {text-transform:uppercase;}

/* useful when http://www.menucool.com/ddmenu/one-menu-for-all-pages */
#ddmenuLink {display:none;}

最佳答案

#ddmenu .full-width .dropdown {
width:40%; // give width as per your need.
padding:0;
margin:0;
}

关于html - 如何减小下拉菜单的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40677552/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com