Script 1-How to create Icon Bar

0
186
Courses - Development - Front-End - Scripts - How to create Icon Bar

Ինչպե՞ս ստեղծել Icon Bar միայն CSS-ով

Courses - Development - Front-End - Scripts - How to create Icon Bar

Քայլ 1 – Ավելացնենք HTML

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>How to create Icon Bar</title>
        <!-- Connect Icon Library -->
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
        <!-- Connect Main Style -->
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <div class="icon-bar-horizontal">
            <a class="active" href="#"><i class="fa fa-home"></i></a>
            <a href="#"><i class="fa fa-search"></i></a>
            <a href="#"><i class="fa fa-envelope"></i></a>
            <a href="#"><i class="fa fa-globe"></i></a>
            <a href="#"><i class="fa fa-trash"></i></a>
        </div>
        <div class="icon-bar-vertical">
            <a class="active" href="#"><i class="fa fa-home"></i></a>
            <a href="#"><i class="fa fa-search"></i></a>
            <a href="#"><i class="fa fa-envelope"></i></a>
            <a href="#"><i class="fa fa-globe"></i></a>
            <a href="#"><i class="fa fa-trash"></i></a>
        </div>
    </body>
</html>
&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
    &lt;head&gt;
        &lt;meta charset="UTF-8"&gt;
        &lt;title&gt;How to create Icon Bar&lt;/title&gt;
        &lt;!-- Connect Icon Library --&gt;
        &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"&gt;
        &lt;!-- Connect Main Style --&gt;
        &lt;link rel="stylesheet" href="style.css"&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;div class="icon-bar-horizontal"&gt;
            &lt;a class="active" href="#"&gt;&lt;i class="fa fa-home"&gt;&lt;/i&gt;&lt;/a&gt;
            &lt;a href="#"&gt;&lt;i class="fa fa-search"&gt;&lt;/i&gt;&lt;/a&gt;
            &lt;a href="#"&gt;&lt;i class="fa fa-envelope"&gt;&lt;/i&gt;&lt;/a&gt;
            &lt;a href="#"&gt;&lt;i class="fa fa-globe"&gt;&lt;/i&gt;&lt;/a&gt;
            &lt;a href="#"&gt;&lt;i class="fa fa-trash"&gt;&lt;/i&gt;&lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="icon-bar-vertical"&gt;
            &lt;a class="active" href="#"&gt;&lt;i class="fa fa-home"&gt;&lt;/i&gt;&lt;/a&gt;
            &lt;a href="#"&gt;&lt;i class="fa fa-search"&gt;&lt;/i&gt;&lt;/a&gt;
            &lt;a href="#"&gt;&lt;i class="fa fa-envelope"&gt;&lt;/i&gt;&lt;/a&gt;
            &lt;a href="#"&gt;&lt;i class="fa fa-globe"&gt;&lt;/i&gt;&lt;/a&gt;
            &lt;a href="#"&gt;&lt;i class="fa fa-trash"&gt;&lt;/i&gt;&lt;/a&gt;
        &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;

Քայլ 2 – Ավելացնենք CSS(Horizontal)

.icon-bar-horizontal {
    width: 900px;
    background-color: #555;
    overflow: auto;
    margin: 0 auto;
}

.icon-bar-horizontal a {
    float: left;
    text-align: center;
    width: 20%;
    padding: 12px 0;
    transition: all 0.3s ease;
    color: white;
    font-size: 36px;
}

.icon-bar-horizontal a:hover {
    background-color: #000;
}

.icon-bar-horizontal a.active {
    background-color: #4CAF50;
}
.icon-bar-horizontal {
    width: 900px;
    background-color: #555;
    overflow: auto;
    margin: 0 auto;
}

.icon-bar-horizontal a {
    float: left;
    text-align: center;
    width: 20%;
    padding: 12px 0;
    transition: all 0.3s ease;
    color: white;
    font-size: 36px;
}

.icon-bar-horizontal a:hover {
    background-color: #000;
}

.icon-bar-horizontal a.active {
    background-color: #4CAF50;
}

Քայլ 3 – Ավելացնենք CSS(Vertical)

.icon-bar-vertical {
    width: 90px;
    background-color: #555;
}

.icon-bar-vertical a {
    display: block;
    text-align: center;
    padding: 16px;
    transition: all 0.3s ease;
    color: white;
    font-size: 36px;
}

.icon-bar-vertical a:hover {
    background-color: #000;
}

.icon-bar-vertical a.active {
    background-color: #4CAF50;
}
.icon-bar-vertical {
    width: 90px;
    background-color: #555;
}

.icon-bar-vertical a {
    display: block;
    text-align: center;
    padding: 16px;
    transition: all 0.3s ease;
    color: white;
    font-size: 36px;
}

.icon-bar-vertical a:hover {
    background-color: #000;
}

.icon-bar-vertical a.active {
    background-color: #4CAF50;
}

Ներբեռնել

Icon Bar Script-ի ամբողջական ֆայլերը ներբեռնելու համար. Download