Содержимое располагается под навигацией (строка меню): адаптивный веб-сайт.CSS

Разбираемся в CSS
Ответить Пред. темаСлед. тема
Anonymous
 Содержимое располагается под навигацией (строка меню): адаптивный веб-сайт.

Сообщение Anonymous »

Я решил загрузить свой адаптивный веб-сайт, но заметил, что его содержимое (в данном случае фиктивный текст) не остается под меню навигации.

( http://www.azhir.co.uk/web_zip/default.html )

Как вы увидите, что это базовый стиль CSS, и я использую стиль CSS для создания строки меню «гамбургер».

html, body {
margin: 0;
padding: 0;
width: 100%;
}

body {
font-family: "Helvetica Neue",sans-serif;
font-weight: lighter;
}

header {
width: 100%;
height: 0.01vh;
background-color: red;
}

.content {
width: 94%;
margin: 4em auto;
font-size: 20px;
line-height: 30px;
text-align: justify;
}

.logo {
line-height: 60px;
position: fixed;
float: left;
margin: 16px 46px;
color: black;
font-weight: bold;
font-size: 20px;
letter-spacing: 2px;
}

nav {
position: fixed;
width: 100%;
line-height: 60px;
}

nav ul {
line-height: 60px;
list-style: none;
background: rgba(0, 0, 0, 0); /*transparency rgba(0,0,0,0)*/
overflow: hidden;
color: #fff;
padding: 0;
text-align: right;
margin: 0;
padding-right: 40px;
transition: 1s;
}

nav.black ul {
background: white; /*changes color of bar*/
}

nav ul li {
display: inline-block;
padding: 16px 40px;;
}

nav ul li a {
text-decoration: none;
color: black;
font-weight: bold;
font-size: 16px;
}

.menu-icon {
line-height: 60px;
width: 100%;
background: white; /*changes hamburger color*/
text-align: right;
box-sizing: border-box;
padding: 15px 24px;
cursor: pointer;
color: black;
display: none;
}

@media(max-width: 786px) {

.logo {
position: fixed;
top: 0;
margin-top: 16px;
}

nav ul {
max-height: 0px;
background: white; /*mobile color*/
}

nav.black ul {
background: white;
}

.showing {
max-height: 34em;
}

nav ul li {
box-sizing: border-box;
width: 100%;
padding: 24px;
text-align: center;
}

.menu-icon {
display: block;
}

}


Это CSS для моего меню.css

body{
margin: 0;
font-family: Arial, Helvetica, sans-serif;
background-color: white;
}

a{
color: black;
}

.header{
background-color: white;
box-shadow:1px 1px 4px 0 rgba(0,0,0,.1);
position:fixed;
width:100%;
z-index:3;
}

.header ul{
margin:0;
padding:0;
list-style:none;
overflow:hidden;
background-color:white;
}

.header ul a{
display:block;
padding:20px;
boder-right:1px solid grey;
text-decoration: none;
}

.header ul a:hover{
background-color: #e6e6e6;
}

.header .logo{
float:left;
display:block;
font-size: 2em;
padding: 10px 20px;
text-align: center;
text-decoration: none;
}

.header .menu{
clear:both;
max-height:0;
transition:max-height .2s ease-out;
}

/*hamburger*/

.header .menu-icon{
padding: 28px 20px;
position: relative;
float:right;
cursor:pointer;
}

.header .menu-icon .nav-icon{
background:black;
display: block;
height:2px;
width:18px;
position:relative;
transition: background .2s ease-out;
}

.header .menu-icon .nav-icon:before{
background:black;
content:"";
display:block;
height:100%;
width:100%;
position:absolute;
transition: all .2s ease-out;
top:5px;
}

.header .menu-icon .nav-icon:after{
background:black;
content:"";
display:block;
height:100%;
width:100%;
position:absolute;
transition: all .2s ease-out;
top:-5px;
}

.header .menu-btn{
display: none;
}

.header .menu-btn:checked ~ .menu{
max-height:240px;
}

.header .menu-btn:checked ~ .menu-icon .nav-icon{
background: transparent;
}

.header .menu-btn:checked ~ .menu-icon .nav-icon:before{
transform: rotate(-45deg);
top:0;
}

.header .menu-btn:checked ~ .menu-icon .nav-icon:after{
transform: rotate(45deg);
top:0;
}

@media (min-width:48em){
.header li{
float:left;
}
.header li a{
padding:20px 30px;
}

.header .menu{
clear:none;
float:right;
max-height: none;
}

.header .menu-icon{
display:none;
}

.header .logo{
float:left;
display:block;
font-size: 2em;
padding: 10px 8%;
text-align: center;
text-decoration: none;
}

}

/*content*/
.content {
width: 85%;
font-size: 20px;
line-height: 30px;
text-align: inherit;
margin-left: auto;
margin-right: auto;
}


и HTML-код довольно простой и простой;



[*]




Azhir Mahmood




Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.







Подробнее здесь: https://stackoverflow.com/questions/602 ... ve-website
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «CSS»