私のwpベースのWebサイトでは、サブメニューはメインメニューの幅を継承しています。ただし、サブメニューのテキストがその中に収まるように、少し大きくする必要があります。これどうやってするの ?
これが私のCSSです
#edited_menubar {
width: 620px;
height:22px;
/*
margin-left: 528px;
padding-left: 10px;
margin-right: 10px;
margin-bottom:5px ;
*/
padding-left: 360px;
padding-top:35px;
}
#mainmenu {
margin: 30px 20px 0px 0px;
word-wrap: break-word;
}
ul#mainmenu-menu {
position: relative;
background: rgb(247,247,247);
background: -moz-linear-gradient(top, rgba(247,247,247,1) 0%, rgba(244,244,244,1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(247,247,247,1)), color-stop(100%,rgba(244,244,244,1)));
background: -webkit-linear-gradient(top, rgba(247,247,247,1) 0%,rgba(244,244,244,1) 100%);
background: -o-linear-gradient(top, rgba(247,247,247,1) 0%,rgba(244,244,244,1) 100%);
background: -ms-linear-gradient(top, rgba(247,247,247,1) 0%,rgba(244,244,244,1) 100%);
background: linear-gradient(top, rgba(247,247,247,1) 0%,rgba(244,244,244,1) 100%);
border: 1px solid #E2E2E2;
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f7f7', endColorstr='#f4f4f4',GradientType=0 );
}
ul#mainmenu-menu li {
width: 100px;
}
ul#mainmenu-menu li.menu-item {
position: relative;
border-right: 1px solid #E2E2E2;
display: block;
float: left;
font-size: 11px;
font-weight: bold;
}
ul#mainmenu-menu > li:nth-child(6) {
border-right: none;
}
ul#mainmenu-menu li.menu-item a {
color: #5e5e5e;
display: block;
padding: 5px 8px;
text-decoration: none;
}
ul#mainmenu-menu li.menu-item a:hover {
background: #F9F9F9;
}
/* =Main Menu : Scaled Menu
-------------------------------------------------------------- */
#mainmenu.scaled .container > div {
width: 100%;
height: 32px;
display: table;
}
#mainmenu.scaled ul#mainmenu-menu {
height: 32px;
display: table-row;
}
#mainmenu.scaled li.menu-item {
width: auto;
height: 52px;
border: none;
display: table-cell;
float: none;
}
#mainmenu.scaled li.menu-item a {
border: 1px solid #E2E2E2;
border-width: 1px 1px 1px 0;
text-align: center;
}
#mainmenu.scaled li.menu-item:first-child a {
border-left-width: 1px;
}
#mainmenu.scaled li.menu-item:first-child a {
border-right-width: none;
}
#mainmenu.scaled ul#mainmenu-menu ul.sub-menu li {
border-width: 0;
display: block;
}
#mainmenu.scaled ul#mainmenu-menu ul.sub-menu a {
border: none;
}
#mainmenu ul li > ul li {
width:300px;
}
/* =Main Menu : Main Dropdown
-------------------------------------------------------------- */
ul#mainmenu-menu li.menu-item a {
height: 28px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
color: #5e5e5e;
display: block;
padding: 10px 20px; /*spacing between list item */
text-decoration: none;
}
ul#mainmenu-menu ul.sub-menu {
position: absolute;
top: 27px;
left: 0px;
width: 100%;
background: white;
border: none;
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
display: none;
z-index: 99;
}
ul#mainmenu-menu li:hover ul.sub-menu {
display: block;
}
ul#mainmenu-menu ul.sub-menu li {
border: none;
display: block;
float: none;
font-weight: normal;
white-space: nowrap;
}
ul#mainmenu-menu ul .sub-menu.li a {
height: auto;
line-height: 15px;
padding: 15px 15px 15px 15px;
}
私の作業サイト:aniyanetworks.net/Blog