Как я могу установить эту навигационную панель внизу? - PullRequest
0 голосов
/ 08 мая 2020

Я хотел бы знать, как я могу установить эту навигационную панель внизу страницы. Все перепробовал но внизу вроде не ставится. Я пробовал использовать bottom, margin-bottom, я также не знаю, есть ли конфигурация, которую я уже установил в моем css, которая не позволяет этим командам, упомянутым ранее, работать.

HTML

<!doctype html>
{%load staticfiles%}
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Home</title>
    <link rel="stylesheet" href="{%static 'index/css/index.css'%}">
    <link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/glacial-indifference" type="text/css"/>
    <script src="https://kit.fontawesome.com/b525a42bf1.js" crossorigin="anonymous"></script>
</head>
<body>

<div class="logo"><h2>MediTracker</h2></div>

<nav>
    <div class="menu">
        <ul class="clear">
            <li><a href="" title="home"><i class="fa fa-home"></i><span class="link-text">Home</span></a></li>
            <li><a href="" title="about"><i class="fa fa-question-circle"></i><span class="link-text">About</span></a></li>
            <li><a href="" title="pricing"><i class="fa fa-money-bill-alt"></i><span class="link-text">Pricing</span></a></li>
            <li><a href="" title="services"><i class="fa fa-tools"></i><span class="link-text">Services</span></a></li>
            <li><a href="" title="contact"><i class="fa fa-phone"></i><span class="link-text">Contact Us</span></a></li>
        </ul>
    </div>
</nav>


</body>
</html>

CSS

body{
    background-color: #333;
    background-size: cover;
    background-position: center;
    font-family: 'GlacialIndifferenceRegular';
    overflow: hidden;
    font-weight: 600;
    height: 85vh;
}

a{
    text-decoration: none;
}

.clear:after{
    content: "";
    display: block;
    clear:both;
}

nav .menu{
    text-align: center;
    margin-bottom:0px;
    width: 100%;
}

nav .menu ul{
    list-style: none;
    display: inline-block;
}

nav .menu ul li{
    float: left;
    width: 150px;
    height: 150px;
    background-color: white;
    transition: background-color 0.2s linear 0s;
}

nav .menu ul li a{
    display: table;
    width: 100%;
    height: 100%;
    position: relative;
    text-align: center;
}

nav .menu a i{
    display: block;
    vertical-align: middle;
    color: #333;
    font-size: 23px;
    transform: all 0.2s linear 0s;
    padding: 44px 0 10px;
}

nav .menu a i:before{
    width: 41px;
    display: inline-block;
    height: 41px;
    line-height: 37px;
    transition: color 0.2s linear 0s,
                font-size 0.2s linear 0s,
                border-color 0.2s linear 0.2s,
                height 0.2s linear 0s,
                line-height 0.2s linear 0s;
}

nav .menu a .link-text{
    right: 45px;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    transition: all 0.2s linear 0s;
}

nav .menu ul li:hover{
    background-color: #42d3e3;
}

nav .menu ul li:hover + li:last-child{
    border-right-color: blue;
}

nav .menu ul li:hover .link-text{
    opacity: 0;
}

nav .menu ul li:hover i{
    color: #333;
    font-size: 50px;
}

nav .menu ul li:hover i:before{
    border-color: transparent;
    border-radius: 500px;
    line-height: 40px;
    transition: color 0.2s linear 0s,
            font-size 0.2s linear 0s,
            border-color 0.2s linear 0.2s,
            height 0.2s linear 0s,
            line-height 0.2s linear 0s;
}

Ответы [ 3 ]

1 голос
/ 08 мая 2020

Вы можете попробовать позицию: fixed:

nav{
   position:fixed;
    bottom:0;
    left:0;
    width:100%;
}
1 голос
/ 08 мая 2020

Вы можете установить nav .menu как position: absolute; bottom:0;

nav .menu{
    text-align: center;
    margin-bottom:0px;
    width: 100%;
    position: absolute;
    bottom:0;
}

JsFiddle https://jsfiddle.net/viethien/gxw0dacb/3/

0 голосов
/ 08 мая 2020

В дополнение к margin-bottom: 0 попробуйте добавить bottom: 0. margin-bottom не создает только margin в нижней части элемента, но это не создает элемент в нижней части пользовательского интерфейса. Свойство и значение bottom: 0 сделают пространство 0 снизу до элемента. Возможно, это сбивает с толку, но код для панели навигации должен выглядеть так:

nav .menu{
    text-align: center;
    margin-bottom: 0px;
    bottom: 0;
    width: 100%;
}

Подробнее о свойстве bottom можно узнать здесь .

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...