在移动设备中没有水平滚动

时间:2017-11-23 20:48:55

标签: html css html5 css3

所以,我想进行水平滚动并禁用垂直滚动。我该怎么办?

P.S。此外,在更改浏览器大小时,我对网站的视图有疑问。

请给我建议并告诉我该怎么做。

(没有更多细节)

无法水平滚动:

enter image description here

使用垂直滚动时会发生这种情况:

enter image description here

This is Site

f2py
* {
  margin: 0;
  padding: 0;
}

html {
    width: 100%;
	height: 100%;
}
body {
    height: 100%;
    margin:0px;
    overflow: hidden;
}

.Header {
    background-repeat: no-repeat;
    background-position: top;
    position: absolute;
    vertical-align: top;
    width:100%; 
    height:13.5%;
    z-index: 2;
}

.News {
    color: #6a70b3;
    font-family: verdana, arial, helvetica, "sans-serif";
    font-size: 11.3333px;
    line-height: 17px;
    font-weight: 700;
    text-align: left;
    margin-right: 40%;
    padding-bottom: 2%;
}

section { /*Контент*/
    font-family: Arial;
    color: #000000;
    font-size: 12.8px;
    vertical-align: middle;
    text-align: left;
    width:900px; 
    height:300px; 
    position:fixed; 
    left:20%; 
    top:110px;
    padding-bottom: 90px;
    flex: 1 0 auto;
}

section a:visited {
    color:#003399;
}

section a:hover {
    color: black;
}

aside { /*Sidebar*/
    padding: 5% 0.5%;
    margin: 0% auto;
    position: fixed;
    left: 0;
    width:15%; 
    background-image: url(../images/side.png);
    background-repeat:repeat-y;
    background-size: 75%;
    height: 100%;
    top: 10%;
    z-index: 1;
}

aside li { /*Sidebar Список */
    font-family: Verdana, Arial , "sans-serif", helvetica;
    font-size: 11px;
    margin-bottom: 5%;
    width: 70%;
    font-weight: 700;
    text-align: left;
    line-height: 15px;
    z-index: 2;
    
}
/* Стиль верхней панели навигации */
.topnav {
    margin:6.2%;
    margin-left: 20%;
    overflow: hidden;
    width: 100%;
    height: 2.5%;
    top: 0%;
    position: fixed;
    background-color: red;
    text-align:center;
    z-index: 2;
    
}

/* Стиль ссылок навигации */
.topnav a {
    margin:0 auto;
    display:inline;
    margin-left:3px;
    margin-top: 3px;
    line-height: 7px;
    font-size: 11px;
    font-weight: 700;
    float:left;
    font-family: verdana, "sans-serif", helvetica, arial;
    display: block;
    color: #f2f2f2;
    text-align: center;
    padding: 5px 10px;
    text-decoration: none;
    z-index: 3;
}

/* Изменение цвета при наведении */
.topnav a:hover {
    color: orange;
}

ul {
    list-style-type: none; /* Убираем маркеры */
    text-decoration: none; /* Убираем подчёркивание */
    margin-left: 0; /* Отступ слева в браузере IE и Opera */
    padding-left: 0; /* Отступ слева в браузере Firefox, Safari, Chrome */
}

ul a{
    list-style-type: none;
    text-decoration: none;
    color: darkblue;
}

ul a:hover{
    list-style-type: none;
    text-decoration: none;
    color:orange;
}

#mainText {
    text-align: center;
}

.border {
    color:black;
}

table, th, td {
    border: 1px solid black;
}

footer { /*Подвал*/
    text-align: center;
    margin-right:0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 0px;
    color: white;
    text-align: center;
    min-height: 50px;
    float: none;
    position: fixed;
}

footer a{ 
    font-family: Arial;
    font-size: 10.6667px;
    line-height: 14px;
    font-weight: 400;
    position: absolute;
    left: 5%;
    top: 17%;
    width: 100%;
    color: white;
    text-decoration: none;
    color:#06C;
    height: 50px;
    float: none;
}

.footerline {
    position: fixed;
    bottom: 1px;
    left: 0px;
    float: none;
}


@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) { /*iPad*/
    body {
        overflow: scroll;
    }
    aside {
        min-width: 17%;
        min-height: 100%;
        top: 5%;
    }
    
    .topnav {
        top: 0.5%;
    }
}


@media only screen and (min-device-width : 320px) and (max-device-width : 568px) {
/*iPhone SE*/
    body {
        overflow-x: auto;
    }
        aside {
        min-width: 55%;
        min-height: 100%;
        top: 8%;
    }
    
    header {
        
    }
    .topnav {
        top: 5.4%;
        left: 40%;
        height: 3.5%;
    }
    
    section {
        top: 14%;
        left: 61%;
    }
    
    footer a{
        left: 80%;
    }
}

@media (min-width: 1650px) { /*fullHD*/
    aside {
        width: 10%;
        min-height: 100%;
        top: 8%;
    }
    
    .topnav {
        top: -2.3%;
        height: 2%;
    }
    
    .News {
    color: #6a70b3;
    font-family: verdana, arial, helvetica, "sans-serif";
    font-size: 12.3333px;
    line-height: 17px;
    font-weight: 700;
    text-align: left;
    margin-right: 50%;
    padding-top: 2%;
    padding-left: 14%;
    }
}

1 个答案:

答案 0 :(得分:0)

看起来你真的搞砸了HTML代码和CSS。对于您工作的任何网站,您应该清楚地了解布局结构。我建议你学习bootstrap,这对你有很大的帮助。



nav{float: left;width: 75%;}
.News {
    color: #6a70b3;
    font-family: verdana, arial, helvetica, "sans-serif";
    font-size: 11.3333px;
    line-height: 17px;
    font-weight: 700;
    text-align: left;
    margin-right: 40%;
    padding-bottom: 2%;
}

section { /*Контент*/
        font-family: Arial;
    color: #000000;
    font-size: 12.8px;
    float: left;
    width: 75%;
}

section a:visited {
    color:#003399;
}

section a:hover {
    color: black;
}

aside { /*Sidebar*/
    padding: 5% 0.5%;
    margin: 0% auto;
    width: 20%;
    background-image: url(../images/side.png);
    background-repeat: repeat-y;
    background-size: auto;
    float: left;
}

aside li { /*Sidebar Список */
    font-family: Verdana, Arial , "sans-serif", helvetica;
    font-size: 11px;
    margin-bottom: 5%;
    width: 70%;
    font-weight: 700;
    text-align: left;
    line-height: 15px;
    z-index: 2;
    
}
/* Стиль верхней панели навигации */
.topnav {
        margin: 6.2% 0;
    width: 100%;
    background-color: red;
    text-align: center;
    float: left;
    
}

/* Стиль ссылок навигации */
.topnav a {
        margin-left: 3px;
    margin-top: 3px;
    line-height: 7px;
    font-size: 11px;
    font-weight: 700;
    font-family: verdana, "sans-serif", helvetica, arial;
    color: #f2f2f2;
    text-align: center;
    padding: 5px 10px;
    text-decoration: none;
}

/* Изменение цвета при наведении */
.topnav a:hover {
    color: orange;
}

ul {
    list-style-type: none; /* Убираем маркеры */
    text-decoration: none; /* Убираем подчёркивание */
    margin-left: 0; /* Отступ слева в браузере IE и Opera */
    padding-left: 0; /* Отступ слева в браузере Firefox, Safari, Chrome */
}

ul a{
    list-style-type: none;
    text-decoration: none;
    color: darkblue;
}

ul a:hover{
    list-style-type: none;
    text-decoration: none;
    color:orange;
}

#mainText {
    text-align: center;
}

.border {
    color:black;
}

table, th, td {
    border: 1px solid black;
}

footer { /*Подвал*/
        width: 100%;
    text-align: center;
    float: left;
}



.footerline {
    position: fixed;
    bottom: 1px;
    left: 0px;
    float: none;
}



    .News {
    color: #6a70b3;
    font-family: verdana, arial, helvetica, "sans-serif";
    font-size: 12.3333px;
    line-height: 17px;
    font-weight: 700;
    text-align: left;
    margin-right: 50%;
    padding-top: 2%;
    padding-left: 14%;
    }
}

<!DOCTYPE html>
<html lang="ru">
    <head>    
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/index.css">
<title>Новости - Анонсы</title>
    </head>
<body>
     <header>
    <img src="images/headerfinal.png" class="Header" alt="Header">
    </header>
	
	<aside> <!-- Меню слева -->
<ul>
<br>
<br>
<br>
<li><a href="news.html">Новости</a></li>
<li><a href="#top">О Суде</a></li>
<li><a href="#top">Решения КС РФ</a></li>
<li><a href="#top">Заседания КС РФ</a></li>
<li><a href="#top">Контакты</a></li>
</ul>
<br>
<img src="images/gerb.gif" alt="Герб РФ" align=center>
    </aside>  
    <nav>
    <div class="topnav"> <!--Верхнее меню -->
  <a href="news.html">Новости</a>
  <a href="#top">О Суде</a>
  <a href="#top">Решения КС РФ</a>
  <a href="#top">Заседания КС РФ</a>
  <a href="#top">Контакты</a>
    </div>
    </nav>
 
    <section> <!-- Основной текст -->
<div class="News"><h3>Новости - Анонсы</h3></div>
<br>
<p>10 ноября 2017 года Конституционный Суд РФ провозгласит Постановление по делу о проверке конституционности Федерального закона «О внесении изменений в отдельные законодательные акты РФ в части совершенствования законодательства о публичных мероприятиях»</p>
<br>
<p>( <a href="#top">подробнее...</a>)</p>
<br>
<p>7 ноября 2017 года Конституционный Суд РФ провозгласил Постановление по делу о проверке конституционности ряда положений Закона Республики Крым «Об особенностях регулирования имущественных и земельных отношений на территории Республики Крым»</p>
<br>
<p>( <a href="#top">подробнее...</a>)</p>

<br>
    <a href="#top">Посмотреть все новости</a>
<br>
    </section>

<br>
<br>
    <footer>
        <hr style="border:1px;width:60%; height:1px;background-color:black">
    <img src="images/footer.PNG" class=footerline alt="Footer">
        <a href="index.html">©Конституционный Суд Российской Федерации, 2008-2017</a>
    </footer>
</body>
</html>
&#13;
&#13;
&#13;

您可以使用此代码希望它可以帮助您。

相关问题