@Pbalordorbaor

Как позиционировать списки html?

html
<!DOCTYPE html>
<html lang="ru">
<head>
	<meta charset="UTF-8">
	<title></title>
	<link rel="stylesheet" type="text/css" href="css/reset.css">
	<link rel="stylesheet" type="text/css" href="css/styles.css">
	<link rel="stylesheet" type="text/css" href="fonts/font.ttf">
</head>
<body>
	<div class="navbar">
		<ul>
	      <li><img src="img/Hamburger_icon.svg.png" class="img"></li>
		  <li><a href="#" class="home">Home</a></li>
		  <li><a href="#" class="item first">first page</a></li>
		  <li><a href="#" class="item second">second page</a></li>
		  <li><a href="#" class="item third">third page</a></li>
		</ul>
	</div>
</body>
</html>


CSS
body {
	width: 100%;
}

@media (max-width: 1024px) {

    .navbar {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 100%;
        background-color: #658680;
        padding-top: 1%;
        padding-bottom: 1%;
        position: fixed;
    }

    .home {
        color: white;
        text-decoration: none;
        font-family: 'FuturaNormal', arial;
        font-size: 25px;
        display: inline-block;
        position: relative;
        margin-bottom: 1%;
    }

    .item {
        color: white;
        text-decoration: none;
        font-family: 'FuturaNormal', arial;
        font-size: 25px;
        display: inline-block;
        position: relative;
        margin-bottom: 1%;
    }

    .img {
        width: 25px;
        height: 25px;
        margin-left: 85%;
    }
}

@media(min-width: 1024px) {

    .img {
        display: none;
    }

.navbar {
	display: flex;
    justify-content: center;
    align-items: center;
	width: 100%;
	background-color: #658680;
	padding-top: 1%;
	padding-bottom: 1%;
	position: fixed;
}

.home {
	color: white;
	text-decoration: none;
	font-family: 'FuturaNormal', arial;
	font-size: 25px;
	display: inline-block;
    position: relative;
}

.home::before {
    display: block;
    position: absolute;
    content: "";
    height: 2px;
    width: 0;
    background-color: white;
    transition: width .2s ease-in-out, left .2s ease-in-out;
    left: 50%;
    bottom: -5px;
}

.home::after {
    display: block;
    position: absolute;
    content: "";
    height: 2px;
    width: 0;
    background-color: white;
    transition: width .2s ease-in-out;
    left: 50%;
    bottom: -5px;
}

.home:hover::before {
    width: 50%;
    left: 0;
}

.home:hover::after {
    width: 50%;
}

.item {
	color: white;
	text-decoration: none;
	font-family: 'FuturaNormal', arial;
	font-size: 25px;
    margin-left: 10%;
}

.item::after {
    display: block;
    position: relative;
    content: "";
    height: 2px;
    width: 0;
    background-color: white;
    transition: width .5s ease-in-out;
    left: 0;
    bottom: -5px;
}


.item:hover::after {
	width: 100%;
	left: 0;
 }
}

li {
    display: block;
}


Как сделать так чтобы элементы списка выводились в одну строку. Сейчас каждый элемент списка выводится с новой строки
  • Вопрос задан
  • 79 просмотров
Решения вопроса 1
@jugo45
Либо:
li{
display: inline-block;
}

, либо:
li{
float: left;
}
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
FeST1VaL
@FeST1VaL
Тихий
li {
    display: block;
}


На

li {
    display: inline-block;
}
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы