我正在建立一个网站,我遇到了一个问题。 网站顶部的图像大小没有达到100%,在计算机中一切正常,但在手机上它会将此栏留空。 我尝试了一切,研究了论坛,尝试了一切,但找不到解决方案。
此布局无响应,仅适用于移动屏幕。 下面是该网站的截图和部分代码。
如果有人想访问该网站,请点击以下链接: http://www.cr6arquitetura.com.br/
body {
margin: 0 auto;
padding: 0 auto;
font-family: 'Noto Sans', sans-serif;
}
h1 {
font-size: 5.0em;
color: #efc500;
}
h3 {
font-size: 2.5em;
color: #000000;
font-weight: normal;
font-style: italic;
}
h4 {
font-size: 1.5em;
color: #000000;
font-weight: normal;
position: relative;
bottom: 25px;
}
#bgmain {
background: url(img/main.jpg) no-repeat;
background-color: #efc500;
background-position: center center;
background-attachment: fixed;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-ms-background-size: cover;
-o-background-size: cover;
margin: 0 auto;
padding: 0 auto;
width: 100%;
height: 100%;
}
#barra {
height: 130px;
width: 100%;
background-color: white;
opacity: 0.8;
filter: alpha(opacity=80%);
}
#logo {
float: left;
margin-left: 5px;
}
#menu ul {
margin: 0px auto;
margin-top: 50px;
list-style: none;
float: right;
margin-right: 5px;
}
#menu ul li {
display: inline;
}
#menu ul li a {
font-size: 18px;
color: #efc500;
font-weight: bold;
margin-left: 30px;
text-decoration: none;
}
#menu ul li a:hover {
border-bottom: 6px solid #efc500;
}
#textomiddle {
width: 1050px;
margin: 0 auto;
margin-top: 150px;
}
#botao {
margin-left: auto;
margin-right: auto;
text-align: center;
width: 350px;
height: 70px;
display: block;
text-align: center;
margin-bottom: 30px;
background-color: #FFFFFF;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
opacity: 0.8;
filter: alpha(opacity=80%);
}
#botao:hover {
background-color: #FFFFFF;
opacity: 1;
filter: alpha(opacity=100%);
}
a.link {
text-decoration: none;
display: inline-block;
color: #efc500;
font-family: 'Noto Sans', sans-serif;
margin-top: 17px;
font-size: 25px;
}
<link href="https://fonts.googleapis.com/css?family=Noto+Sans:400,400i,700" rel="stylesheet">
<div id="bgmain">
<!-- THIS IS THE MAIN DIV FOR THE BACKGROUND IMAGE-->
<!-- -->
<div id="barra">
<!-- THIS IS THE WHITE BAR ON TOP OF WEBSITE-->
<div id="logo">
<!--THIS IS THE LOGO ON TOP LEFT -->
<img class="logo" src="img/cr6logo.png" alt="logo">
</div>
<!-- DIV LOGO END-->
<nav id="menu">
<!-- THIS IS THE MENU -->
<ul>
<li><a href="#">HOME</a></li>
<li><a href="#">NOSSOS TRABALHOS</a></li>
<li><a href="#">QUEM SOMOS</a></li>
<li><a href="#">CONTATO</a></li>
</ul>
</nav>
<!-- MENU END-->
</div>
<!-- BARRA END -->
<div id="textomiddle">
<!-- This is the DIV that stays in the dima of the banner -->
<center>
<h1>SOLUÇÃO COMPLETA EM ARQUITETURA</h1>
</center>
<div id="botao">
<center><a class="link" href="contato.html">FAÇA UM ORÇAMENTO</a></center>
</div>
</div>
<!-- END DIV TEXTOMIDDLE -->
</div>
<!-- END DIV BGMAIN-->
答案 0 :(得分:0)
尝试将此添加到您的css:
@media screen and (min-width: 300px) {
#bgmain {width:1080px;}
}
@media screen and (min-width: 519px) {
#bgmain {width:100%;}
}