我在安装"Mobile Navigation" Wordpress Plugin后遇到问题,为我的自定义主题启用移动菜单,填充了屏幕宽度的100%。那么我如何才能使移动菜单填满屏幕宽度的50%,如下所示?
此处为css for mobile menu
.mn-navigation-wrap.mn-dark [class*="icono-"] {
color: #000; }
.mn-icon-wrap {
position: relative;
padding: 12px;
border: 1px solid transparent;
display: inline-block;
box-sizing: content-box;
vertical-align: top;
background-color: transparent;
margin-bottom: 0;
overflow: hidden;
float: right;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none; }
.mn-icon-wrap:hover {
cursor: pointer; }
.mn-icon-wrap [class*="icono-"], .mn-icon-wrap [class*="icono-"] * {
box-sizing: border-box; }
.mn-icon-wrap [class*="icono-"] {
display: inline-block;
vertical-align: middle;
position: relative;
font-style: normal;
color: #fff;
text-align: left;
text-indent: -9999px;
direction: ltr; }
.mn-icon-wrap [class*="icono-"]:before,
.mn-icon-wrap [class*="icono-"]:after {
content: '';
pointer-events: none; }
.mn-icon-wrap .icono-cross:before {
width: 20px;
height: 2px; }
.mn-icon-wrap .icono-cross:after {
height: 20px;
width: 2px; }
.mn-icon-wrap .icono-cross:before,
.mn-icon-wrap .icono-cross:after {
box-shadow: inset 0 0 0 32px;
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
border-radius: 5px; }
.mn-icon-wrap .icono-bars {
width: 20px;
height: 2px;
box-shadow: inset 0 0 0 32px,0 -6px,0 6px;
margin: 16px 7px;
border-radius: 5px; }
.mn-icon-wrap .icono-cross {
display: none;
width: 30px;
height: 30px;
margin: 2px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg); }
.mn-navigation-wrap {
display: none;
max-height: 60px;
background: #000;
background: #dd3333;
overflow: hidden;
position: fixed;
width: 100%;
top: 0;
z-index: 10000; }
.mn-navigation-wrap.hidebar {
-webkit-transition: max-height 0.3s ease-in-out;
-moz-transition: max-height 0.3s ease-in-out;
-o-transition: max-height 0.3s ease-in-out;
transition: max-height 0.3s ease-in-out; }
.mn-navigation-wrap .mn-logo-text {
float: left;
height: 60px;
line-height: 60px;
padding-left: 20px;
font-size: 24px; }
.mn-navigation-wrap .mn-logo-text a {
color: #fff;
text-decoration: none;
font-family: Georgia;
font-family: ''; }
.mn-navigation-wrap .mn-logo-image {
height: 60px;
display: block;
float: left;
padding: 10px 15px;
-moz-box-sizing: border-box;
box-sizing: border-box; }
.mn-navigation-wrap .mn-logo-image img {
height: 100%;
width: auto; }
.mn-navigation-wrap .mn-menu-wrap {
display: none;
font-family: Arial;
font-family: ''; }
.mn-navigation-wrap .mn-menu-wrap ul {
clear: both;
padding: 0;
margin: 0; }
.mn-navigation-wrap .mn-menu-wrap .sub-menu a {
padding-left: 50px; }
.mn-navigation-wrap .mn-menu-wrap .sub-menu .sub-menu a {
padding-left: 80px; }
.mn-navigation-wrap .mn-menu-wrap .sub-menu .sub-menu .sub-menu a {
padding-left: 110px; }
.mn-navigation-wrap .mn-menu-wrap .sub-menu .sub-menu .sub-menu .sub-menu a {
padding-left: 140px; }
.mn-navigation-wrap .mn-menu-wrap .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu a {
padding-left: 170px; }
.mn-navigation-wrap .mn-menu-wrap .current-menu-item > a,
.mn-navigation-wrap .mn-menu-wrap .current_page_item > a {
background: rgba(255, 255, 255, 0.2); }
.mn-navigation-wrap .mn-menu-wrap li a {
color: rgba(255, 255, 255, 0.8);
padding: 10px 20px;
display: block;
list-style: none;
text-decoration: none;
line-height: 1.5; }
.mn-navigation-wrap .mn-menu-wrap li a:hover {
background: rgba(255, 255, 255, 0.3); }
.mn-navigation-wrap.mn-dark .mn-logo-text a {
color: #000; }
.mn-navigation-wrap.mn-dark .mn-menu-wrap li a {
color: rgba(0, 0, 0, 0.8); }
.mn-navigation-wrap.mn-dark .mn-menu-wrap li a:hover {
background: rgba(0, 0, 0, 0.3); }
.mn-navigation-wrap.mn-dark .mn-menu-wrap .current-menu-item > a,
.mn-navigation-wrap.mn-dark .mn-menu-wrap .current_page_item > a {
background: rgba(0, 0, 0, 0.2); }
@media only screen and (max-width: 500px) {
html {
padding: 0 !important;
margin: 0 !important;
margin-top: 60px !important; }
html body {
padding: 0 !important;
margin: 0 !important; }
html.mn-open {
overflow: hidden !important;
background: #000;
background: #dd3333; }
html.mn-open body {
overflow: hidden !important; }
html.mn-open .mn-navigation-wrap {
top: 0;
left: 0;
z-index: 10000;
height: 100%;
max-height: 100%;
overflow-y: auto;
background: #000;
background: #dd3333; }
html.mn-open .mn-menu-wrap {
display: block; }
html .mn-navigation-wrap {
display: block; }
html .mn-navigation-wrap.hidebar {
max-height: 0; } }
有关详细信息,请查看my development url
答案 0 :(得分:0)
你应该真的开始使用谷歌浏览器检查这些东西并为自己工作css,下面是非常基本的东西。下面需要进入底部的样式表
有两个问题,红色背景应用于html,因此删除它,然后将width元素设置为您想要的百分比值。
<!doctype html>
<script>
function changeClassValue() {
if(document.getElementById('dropDown').className == "up") {
document.getElementById('dropDown').className = "down";
numberValue = 1;
} else if(document.getElementById('dropDown').className == "down") {
document.getElementById('dropDown').className = "up";
numberValue = 0;
} else {
}
changeTextVisibility();
}
function changeTextVisibility() {
if(numberValue == 1) {
newDiv.appendChild(newParagraph);
} else if(numberValue == 0); {
newDiv.appendChild(newParagraph);
}
}
var numberValue;
var newDiv = document.createElement('div');
var newParagraph = document.createElement('p');
var newParagraphText = document.createTextNode('This is a drop down menu!');
document.body.appendChild(newDiv);
newParagraph.appendChild(newParagraphText); //this is line 26, and is what seems to be broken.
</script>
<style>
</style>
<body style="background-color: skyblue;">
<p id="dropDown" class="up" style="font-size: 25px; padding: 10px 10px;background-color: slategray; display: inline-block;"
onclick="changeClassValue();"><strong><u> >drop down menu< </u></strong></p>
</body>