Menu bar (navbar) is invisible on iphone browsers - html

I just deployed my web app and the nav bar(menu bar) seems to be present but not visible when displayed on iphone browsers(Chrome & Safari) yet it displays perfectly on android browsers.
this is how it displays on android(perfectly):
android mobile view
image of iphone mobile view
iphone mobile view
below is the HTML code for the header:
<header class="s-header">
<div class="header__top">
<div class="header__logo">
<a class="site-logo" href="/">
<h1 class="blog_logo"
>BRICK
STORIES</h1>
</a>
</div>
<div class="header__search">
<form role="search" method="get" action="">
<!-- <span class="hide-content">Search for:</span> -->
<input type="search" style="margin:3rem auto" placeholder="search here" value="{{ request.get.q }}"
name="q">
<input type="submit" class="header__search-submit" value="Search">
</form>
</div><!-- end header__search -->
<!-- toggles -->
<span>Menu</span>
</div> <!-- end header__top -->
<nav class="header__nav-wrap">
{% if user.is_authenticated %}
<h4 style="color: white;font-style: italic;">hello {{ user.first_name }}!</h4>
{% endif %}
<ul class="header__nav">
<li>Home</li>
{% if user.is_authenticated %}
<li>Logout</li>
{% else %}
<li>Register</li>
<li>Login</li>
{% endif %}
<li class="has-children current">
Categories
<ul class="sub-menu">
<li>Lifestyle</li>
<li>Health</li>
<li>Travel</li>
<li>Fashion</li>
<!-- <li>Family</li> -->
<li>Management</li>
<li>Food</li>
</ul>
</li>
<li>About</li>
</ul> <!-- end header__nav -->
<ul class="header__social">
<li class="ss-facebook">
<a href="https://facebook.com/">
<span class="screen-reader-text">Facebook</span>
</a>
</li>
<li class="ss-twitter">
<a href="#0">
<span class="screen-reader-text">Twitter</span>
</a>
</li>
<li class="ss-instagram">
<a href="#0">
<span class="screen-reader-text">Instagram</span>
</a>
</li>
</ul>
</nav> <!-- end header__nav-wrap -->
here is the css:
.blog_logo{
font-family: 'Rajdhani', sans-serif;;
/* padding: 0rem 1.2rem; */
color:white;
letter-spacing:1rem;
font-size: 2.2rem;
padding: 0rem;
margin: 0rem;
}
.s-header {
z-index: 100;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: column nowrap;
-ms-flex-flow: column nowrap;
flex-flow: column nowrap;
width: 300px;
background-color:black;
padding-top: 6.4rem;
padding-right: 3.2rem;
padding-left: 4.4rem;
overflow-y: auto;
overflow-x: hidden;
vertical-align: top;
position: fixed;
bottom: 0;
top: 0;
left: 0;
}
#media screen and (max-width:1100px) {
.s-header {
width: 100%;
background: transparent;
padding: 0;
position: static;
top: 0;
bottom: auto;
}
.header__top {
z-index: 100;
background: black;
width: 100%;
height: 78px;
position: fixed;
top: 0;
left: 0;
}
.header__logo {
color: black;
margin-top: 4px;
-webkit-transform: translate3d(0, -50%, 0);
transform: translate3d(0, -50%, 0);
position: absolute;
top: 50%;
left: 4rem;
}
.header__logo img {
width: 120px;
height: 29px;
}
.header__nav-wrap {
z-index: 99;
background:black;
opacity: 0;
visibility: hidden;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
-ms-flex-pack: start;
-webkit-justify-content: flex-start;
justify-content: flex-start;
margin: 0;
padding: 164px 60px 64px;
overflow-y: auto;
}
.nav-wrap-is-visible .header__top {
border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.nav-wrap-is-visible .header__nav-wrap {
opacity: 1;
visibility: visible;
}
.nav-wrap-is-visible .header__search-trigger {
display: none;
}
.header__nav {
font-size: 20px;
border-top: 1px dotted rgba(255, 255, 255, 0.04);
}
.header__nav > li {
border-bottom: 1px dotted rgba(255, 255, 255, 0.04);
}
.header__nav > li > a {
line-height: 7.2rem;
}
.header__nav li.has-children > a::after {
top: 32px;
}
.header__nav li ul {
font-size: 12px;
}
.header__nav li ul a {
line-height: 4rem;
}
.header__menu-toggle {
z-index: 101;
display: block;
}
.header__search-trigger {
background-image: url(../images/icons/icon-search-w.svg);
height: 20px;
width: 20px;
top: 29px;
right: 9.8rem;
}
.header__search-trigger::before,
.header__search-trigger::after {
display: none;
}
.header__social {
margin-top: 8rem;
}
.header__social a {
height: 4.4rem;
width: 4.4rem;
}
}
#media screen and (max-width:900px) {
.header__search-form::after {
font-size: 1.5rem;
}
.header__search-form input[type="search"] {
max-width: none;
width: 75%;
font-size: 4.2rem;
}
}
.s-header {
z-index: 100;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: column nowrap;
-ms-flex-flow: column nowrap;
flex-flow: column nowrap;
width: 300px;
background-color:black;
padding-top: 6.4rem;
padding-right: 3.2rem;
padding-left: 4.4rem;
overflow-y: auto;
overflow-x: hidden;
vertical-align: top;
position: fixed;
bottom: 0;
top: 0;
left: 0;
}
.header__logo a {
display: block;
margin: 0;
padding: 0;
outline: 0;
border: none;
transition: all 0.3s;
}
.header__logo img {
width: 125px;
height: 30px;
margin: 0;
}
.header__nav-wrap {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: column nowrap;
-ms-flex-flow: column nowrap;
flex-flow: column nowrap;
-webkit-flex: 1 1 0%;
-ms-flex: 1 1 0%;
flex: 1 1 0%;
-ms-flex-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
-webkit-align-items: stretch;
-ms-flex-align: stretch;
align-items: stretch;
max-width: 100%;
background-color:black;
margin-top: 3.2rem;
}

Related

Correct way to write in pure CSS two effects with .active and :hover

I'm styling some links with the following CSS code, I named the links with the className 'nav-menu-link':
.form-header {
background-color: var(--background-color);
display: flex;
align-items: center;
justify-content: center;
transition: all .3s ease-out;
position: relative;
width: 100%;
height: 100px;
}
.form-logo {
display: flex;
align-items: center;
cursor: pointer;
}
.image-logo-container {
box-sizing: border-box;
display: flex;
width: initial;
height: initial;
background: none;
opacity: 1;
border: 0;
margin: 0;
padding: 0;
max-width: 100%;
}
.image-logo-container img {
width: 250px;
height: 52px;
}
.nav-container {
display: flex;
align-items: center;
justify-content: space-between;
height: 100%;
}
.nav-menu {
display: flex;
font-size: 18px;
width: 380px;
align-items: center;
justify-content: space-between;
justify-content: center;
height: 100%;
margin: unset;
}
.nav-menu-item {
display: flex;
height: 100px;
align-items: center;
margin-left: 50px;
}
.nav-menu-link {
display: flex;
height: 100%;
align-items: center;
color: rgba(255, 255, 255, 0.5);
border-bottom: 2px solid transparent;
}
.nav-menu-link.active {
font-weight: bold;
color: var(--white);
}
.nav-menu-link:hover {
color: var(--white);
border-bottom: 2px solid var(--explorer);
transition: all .2s ease-in-out;
}
#media (min-width: 998px) {}
#media (min-width: 768px) {}
<header class="form-header">
<div class="nav-container">
<a class="form-logo" id="navbar-link-form-logo" href="/">
<div class="image-logo-container">
<img src="https://placekitten.com/250/52" alt="" />
</div>
</a>
<nav class="container">
<ul class="row nav-menu">
<li class="nav-menu-item">
<a class="nav-menu-link active" href="/">Home</a>
</li>
<li class="nav-menu-item">
<a class="nav-menu-link" href="/form">Form</a>
</li>
<li class="nav-menu-item">
<a class="nav-menu-link" href="/about">About</a>
</li>
</ul>
</nav>
<ul>
</ul>
</div>
</header>
I did two effects, one is when the link is active with the '.active' class, and another is when I hover over the link with the 'hover'.
In pure CSS, the correct way to do these two effects is as I wrote in the code above?

Using CSS to show and hide some elements

This page is a grid container with some images as posts-list, header, and left menu:
JSFiddle1
When I hover over images two links: "comments" and "view posts" would appear. I want to use the CSS and when I click on either of these two it leads me to something like this:
JSFiddle
I wanted to use display: none; but I don't know where should I put it.
if I understand your question correctly, this is a possible solution to your problem.
function changeContainer(){
if($('.grid-container-before').css('visibility') === 'visible') {
$('.grid-container-before').css('visibility','hidden');
$('.grid-container-before').css('display','none');
$('.grid-container-after').css('visibility','visible');
$('.grid-container-after').css('display','grid');
}
}
body {
padding-top: 73px;
overflow-y: hidden;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
/* ------------ PAGE SCROLLBAR ------------ */
*::-webkit-scrollbar {
width: 2px;
}
*::-webkit-scrollbar-track {
background: white;
}
*::-webkit-scrollbar-thumb {
background-color: grey;
border-radius: 20px;
height: 2px;
}
/* ------------ navbar ------------ */
.header {
display: flex;
position: fixed;
background-color: white;
width: 100%;
justify-content: space-between;
z-index: 7;
font-family: Libre Franklin;
top: 0;
left: 0;
}
.header-flex-list {
display: flex;
margin-top: 10px;
justify-content: flex-end;
flex: 50%;
}
.header-list {
list-style: none;
display: flex;
}
.header-list a {
text-decoration: none;
color: #000;
font-size: 12px;
padding: 0px 20px 0px 20px;
}
.top-icon-container {
display: flex;
padding: 10px 50px;
flex-wrap: wrap;
}
.icon-column {
width: 10%;
border-radius: 50px;
}
.p-column {
width: 28%;
padding-left: 10px;
}
#top-bar-icon {
display: block;
max-width: 100%;
height: auto;
object-fit: cover;
border-radius: 50px;
border: 2px solid #73AD21;
}
/* ------------ LEFT MENU ------------ */
.container {
display: flex;
justify-content: space-between;
height: 100vh;
}
.left-menu {
width: 18%;
order: 1;
height: 100vh;
/* overflow-y: scroll; */
padding: 0px 0px 10px 45px;
}
.menu-list {
list-style: none;
line-height: 2.5rem;
/* display: flex;
flex-direction: column; */
margin-left: -25px;
}
.menu-list a {
text-decoration: none;
}
/* ------------ MAIN POSTS ------------ */
.main-posts {
width: 100%;
order: 2;
padding: 0px 20px 0px 20px;
overflow-y: auto;
text-align: center;
scrollbar-width: thin;
scrollbar-color: grey white;
}
/* ------------ MAIN POSTS LISTS ------------ */
.grid-container-before {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
grid-gap: 1rem;
width: 100%;
margin: 0 auto;
margin-bottom: 6rem;
visibility: visible;
}
.grid-container-after {
display: grid;
grid-template-columns: 80% 1fr;
grid-gap: 10px;
height: 300px;
visibility: hidden;
display:none;
}
.box {
background-color: #20262e;
color: #fff;
border-radius: 3px;
padding: 20px;
font-size: 14px;
}
.posts {
display: flex;
}
.img__wrap {
position: relative;
}
.posts-image {
height: 350px;
width: 100%;
object-fit: cover;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: white;
color: #000;
visibility: hidden;
opacity: 0;
/* transition effect. not necessary */
transition: opacity 0.2s, visibility 0.2s;
}
.text {
color: white;
font-size: 15px;
position: absolute;
top: 50%;
left: 50%;
width: 100%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}
.text a {
color: #000;
text-decoration: none;
padding-right: 20px;
}
[data-title]::after {
content: attr(data-title);
background-color: #000;
color: #fff;
font-size: 13px;
;
position: absolute;
padding: 10px;
bottom: -3.6em;
left: 50%;
white-space: nowrap;
box-shadow: 1px 1px 3px #222222;
opacity: 0;
border: 1px solid #111111;
z-index: 99999;
visibility: hidden;
}
[data-title]:hover::after {
opacity: 1;
transition: all 0.1s ease 0.5s;
visibility: visible;
}
[data-title] {
position: relative;
}
.img__wrap:hover .overlay {
visibility: visible;
opacity: 1;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<head>
<link href="//fonts.googleapis.com/css?family=Karla|Syne|Libre+Franklin|Bai+Jamjuree|Chakra+Petch|Gotu" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<!------------ TOP MENU ------------>
<header id="header" class="header">
<div id="top-container" class="top-icon-container">
<div class="icon-column">
<img id="top-bar-icon" src="https://s4.uupload.ir/files/top-bar-icon_ensh.png" alt="my logo:)">
</div>
<div class="p-column">
<p>Name it what u want!</p>
</div>
</div>
<div class="header-flex-list">
<ul class="header-list">
<li>TERMS OF USE</li>
<li>HAVE A QUESTION</li>
<li>ABOUT ME</li>
</ul>
</div>
</header>
<body>
<div class="container">
<!------------ LEFT MENU ------------>
<nav id="menu" class="left-menu">
<p style="text-decoration: none; color: black;">Filter by:</p>
<ul class="menu-list">
<li><a>Popular pages</a></li>
<li><a>About pages</a></li>
<li><a>Character pages</a></li>
<li><a>Music pages</a></li>
</ul>
</nav>
<!------------ MAIN POSTS ------------>
<section id="main-content" class="main-posts">
<div class="grid-container-before">
<div class="img__wrap">
<img class="posts-image" src="https://www.webdevelopersnotes.com/wp-content/uploads/random-image-display-using-javascript-2.png" alt="project" />
<div class="overlay">
<div class="text">
<button href="#" data-title="comments" onclick="changeContainer()">
<i class="fa fa-comments fa-fw"></i>comment</button>
<button href="#" data-title="view post" onclick="changeContainer()">
<i class="fa fa-external-link fa-fw"></i></button>
</div>
</div>
</div>
</div>
<div class="grid-container-after">
<div class="box a">A</div>
<div class="box b">B</div>
</div>
</section>
</div>
</body>

position fixed for internet explorer

When the screen width becomes less than 767, the menu turns into a burger and on IE it looks different.
The alignment of items with flex disappears (the burger button and the basket are pressed), I sin on the menu that is positioned with
using fixed (becomes fixed at the checkpoint), I think that on IE the menu still takes its
the place, because of which the alignment occurs with its consideration. If you comment out the menu, everything will be ok.
How to fix it?
enter image description here
header in static condition
enter image description here
<div class="header_body">
<a href="#">
<h1>ze<span>bra</span></h1>
</a>
<div class="wrap-align">
<nav class="header_menu">
<ul class="header_list">
<li>Home</li>
<li>Products</li>
<li>Shopping</li>
<li>Contact</li>
</ul>
</nav>
<div class="price">
<a href="#">
<img src="img/Shape1.png" alt="">
</a>
<span>$35.00</span>
<span>▼</span>
</div>
<div class="header_burger">
<span></span>
</div>
</div>
</div>
//css
.header_body {
position: relative;
display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
justify-content: space-between;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
height: 86px;
align-items: center;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
> a {
text-decoration: none;
color: $colorWord_header;
position: relative;
z-index: 5;
display: inline-block;
margin-right: 40px;
}
a > h1 {
font-size: 38px;
font-family: "HelveticaNeueCyr-Bold";
text-transform: uppercase;
}
a > h1 > span {
color: $logo_color;
}
}
.wrap-align {
width: 650px;
display: flex;
justify-content: space-between;
align-items: center;
}
.header_burger {
display: none;
}
.header_menu {
// margin-right: 118px;
}
.header_list {
display: flex;
position: relative;
z-index: 2;
li {
list-style: none;
}
a {
text-decoration: none;
display: inline-block;
color: $colorWord_header;
font-size: 18px;
font-family: "HelveticaNeueCyr-Regular";
padding: 34px 15px;
transition: all 0.3s;
&:hover {
color: #fff;
background-color: $bgc_head;
}
}
}
.price {
position: relative;
z-index: 5;
a {
text-decoration: none;
}
img {
vertical-align: baseline;
}
a + span {
font-size: 24px;
font-family: "HelveticaNeueCyr-Regular";
color: rgb(157, 157, 157);
margin: 0 10px;
}
span + span {
font-size: 18px;
color: rgb(157, 157, 157);
vertical-align: super;
cursor: pointer;
}
}
//#media
.header {
.header_burger {
display: block;
position: relative;
width: 30px;
height: 20px;
position: relative;
z-index: 3;
}
.header_burger:before,
.header_burger:after {
content: "";
position: absolute;
background-color: black;
width: 100%;
height: 2px;
left: 0;
transition: all 0.3s;
}
.header_burger:before {
top: 0;
}
.header_burger:after {
bottom: 0;
}
.header_burger span {
position: absolute;
top: 9px;
left: 0;
background-color: black;
width: 100%;
height: 2px;
transition: all 0.3s;
}
.header_burger.active span {
transform: scale(0);
}
.header_burger.active:before {
transform: rotate(45deg);
top: 9px;
}
.header_burger.active:after {
transform: rotate(-45deg);
bottom: 9px;
}
.header_menu {
position: fixed;
top: -100%;
left: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(255, 255, 255, 0.941);
padding: 130px 0 0 0;
transition: all 0.4s;
z-index: 1;
}
.wrap-align {
width: 300px;
}
.header_menu.active {
top: 0;
}
.header_list {
margin: 0 0 0 20px;
display: block;
li {
// margin: 10px 0;
}
a {
padding: 10px 20px;
}
}
.price {
margin-right: -30%;
}
}

triangle pointing arrow for popup menu

I have a menu (sidebar), when you hover over the corresponding menu item, a second column with a submenu is displayed. I need to make a triangle-pointer, as in the picture (in the question). I can’t understand how this can be done. Share your opinion, please. Thank!
https://i.stack.imgur.com/su151.png
.main {
font-family: PT Sans;
position: relative;
display: flex;
flex-direction: row;
min-height: 100%;
}
.main_menu {
display: flex;
flex-direction: column;
width: auto;
background-color: #38618C;
padding: 50px 0 0 0;
z-index: 1000;
}
.main_menu_content {
display: flex;
flex-direction: column;
position: sticky;
top: 50px;
width: 100%;
}
.main_menu_content_list {
display: flex;
flex-direction: column;
justify-content: space-between;
text-align: center;
height: 700px;
width: 250px;
}
.main_menu_content_list li {
list-style-type: none;
}
.main_menu_content_list a {
display: flex;
flex-direction: column;
align-items: center;
font-style: normal;
font-weight: normal;
font-size: 18px;
line-height: 23px;
color: #D7DFE8;
text-decoration: none;
}
.main_menu_content_list_sub_block {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 55px;
}
.main_menu_content_list_submenu {
justify-content: center;
position: absolute;
padding: 0;
margin: 0;
left: 100%;
height: 100vh;
background-color: #F0F6F8;
box-shadow: 5px 0px 20px rgba(0, 0, 0, 0.25);
top: -50px;
pointer-events: none;
opacity: 0;
transition: all linear 0.1s 0s;
width: 250px;
}
.main_menu_content_list li:hover .main_menu_content_list_submenu {
opacity: 1;
pointer-events: auto;
}
.main_menu_content_list_submenu_popup li:first-child {
margin: 50px 0 0 0;
}
.main_menu_content_list_submenu_popup li:not(:first-child) {
margin: 10px 0 0 0;
}
.main_menu_content_list li:hover > .main_menu_content_list_submenu {
display: flex;
}
.main_menu_content_list_submenu_popup a {
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 21px;
color: #38618C;
}
.main_menu_content_list_submenu_popup a:hover {
color: #38618C;
text-decoration: underline;
}
.main_menu_content_list_submenu_popup a:active {
color: #FF5964;
}
.main_content {
display: flex;
align-items: center;
flex-direction: column;
width: 100%;
max-width: 100%;
height: 100%;
}
<div class="main">
<div class="main_menu">
<div class="main_menu_content">
<ul class="main_menu_content_list">
<li><a href="">
<div class="main_menu_content_list_int"></div>Интернет
</a>
<div class="main_menu_content_list_submenu">
<ul class="main_menu_content_list_submenu_popup">
<li>Подключение</li>
<li>Дополнительные услуги</li>
<li>Настройка соединения</li>
<li>Подключенные дома</li>
</ul>
</div>
</li>
<li><a href="">
<div class="main_menu_content_list_tv"></div>Телевидение
</a>
<div class="main_menu_content_list_submenu">
<ul class="main_menu_content_list_submenu_popup">
<li>Подключение</li>
<li>Новости</li>
<li>Акции</li>
<li>Аналоговое ТВ</li>
<li>Оборудование</li>
<li>Настройка каналов</li>
<li>Подключенные дома</li>
<li>Документы</li>
</ul>
</div>
</li>
<li><a href="">
<div class="main_menu_content_list_video"></div>Видеонаблюдение,<br>домофон
</a>
<div class="main_menu_content_list_submenu">
<ul class="main_menu_content_list_submenu_popup">
<li>Обслуживание</li>
<li>Установка</li>
<li>Заявка на ремонт</li>
<li>Подключение</li>
</ul>
</div>
</li>
<li><a href="">
<div class="main_menu_content_list_tvr"></div>ТВ Реклама
</a></li>
<li><a href="">
<div class="main_menu_content_list_intb"></div>Интернет для бизнеса
</a></li>
<div class="main_menu_content_list_sub_block">
<li>Оплата</li>
<li>О компании</li>
</div>
<li><a href="">
<div class="main_menu_content_list_sub_account"></div>Личный кабинет
</a></li>
</ul>
</div>
</div>
<div class="main_content">
</div>
</div>
Use this css
.main_menu_content_list > li.haveSubmenu > a:after{
content: '';
position: absolute;
border: solid 10px;
border-color: transparent #F0F6F8 transparent transparent;
right: 0;
opacity: 0;
}
.main_menu_content_list > li.haveSubmenu:hover > a:after{
opacity: 1;
}
.main {
font-family: PT Sans;
position: relative;
display: flex;
flex-direction: row;
min-height: 100%;
}
.main_menu {
display: flex;
flex-direction: column;
width: auto;
background-color: #38618C;
padding: 50px 0 0 0;
z-index: 1000;
}
.main_menu_content {
display: flex;
flex-direction: column;
position: sticky;
top: 50px;
width: 100%;
}
.main_menu_content_list {
display: flex;
flex-direction: column;
justify-content: space-between;
text-align: center;
height: 700px;
width: 250px;
}
.main_menu_content_list li {
list-style-type: none;
}
.main_menu_content_list > li.haveSubmenu > a:after{
content: '';
position: absolute;
border: solid 10px;
border-color: transparent #F0F6F8 transparent transparent;
right: 0;
opacity: 0;
}
.main_menu_content_list > li.haveSubmenu:hover > a:after{
opacity: 1;
}
.main_menu_content_list a {
display: flex;
flex-direction: column;
align-items: center;
font-style: normal;
font-weight: normal;
font-size: 18px;
line-height: 23px;
color: #D7DFE8;
text-decoration: none;
}
.main_menu_content_list_sub_block {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 55px;
}
.main_menu_content_list_submenu {
justify-content: center;
position: absolute;
padding: 0;
margin: 0;
left: 100%;
height: 100vh;
background-color: #F0F6F8;
box-shadow: 5px 0px 20px rgba(0, 0, 0, 0.25);
top: -50px;
pointer-events: none;
opacity: 0;
transition: all linear 0.1s 0s;
width: 250px;
}
.main_menu_content_list li:hover .main_menu_content_list_submenu {
opacity: 1;
pointer-events: auto;
}
.main_menu_content_list_submenu_popup li:first-child {
margin: 50px 0 0 0;
}
.main_menu_content_list_submenu_popup li:not(:first-child) {
margin: 10px 0 0 0;
}
.main_menu_content_list li:hover > .main_menu_content_list_submenu {
display: flex;
}
.main_menu_content_list_submenu_popup a {
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 21px;
color: #38618C;
}
.main_menu_content_list_submenu_popup a:hover {
color: #38618C;
text-decoration: underline;
}
.main_menu_content_list_submenu_popup a:active {
color: #FF5964;
}
.main_content {
display: flex;
align-items: center;
flex-direction: column;
width: 100%;
max-width: 100%;
height: 100%;
}
<div class="main">
<div class="main_menu">
<div class="main_menu_content">
<ul class="main_menu_content_list">
<li class="haveSubmenu"><a href="">
<div class="main_menu_content_list_int"></div>Интернет
</a>
<div class="main_menu_content_list_submenu">
<ul class="main_menu_content_list_submenu_popup">
<li>Подключение</li>
<li>Дополнительные услуги</li>
<li>Настройка соединения</li>
<li>Подключенные дома</li>
</ul>
</div>
</li>
<li class="haveSubmenu"><a href="">
<div class="main_menu_content_list_tv"></div>Телевидение
</a>
<div class="main_menu_content_list_submenu">
<ul class="main_menu_content_list_submenu_popup">
<li>Подключение</li>
<li>Новости</li>
<li>Акции</li>
<li>Аналоговое ТВ</li>
<li>Оборудование</li>
<li>Настройка каналов</li>
<li>Подключенные дома</li>
<li>Документы</li>
</ul>
</div>
</li>
<li class="haveSubmenu"><a href="">
<div class="main_menu_content_list_video"></div>Видеонаблюдение,<br>домофон
</a>
<div class="main_menu_content_list_submenu">
<ul class="main_menu_content_list_submenu_popup">
<li>Обслуживание</li>
<li>Установка</li>
<li>Заявка на ремонт</li>
<li>Подключение</li>
</ul>
</div>
</li>
<li><a href="">
<div class="main_menu_content_list_tvr"></div>ТВ Реклама
</a></li>
<li><a href="">
<div class="main_menu_content_list_intb"></div>Интернет для бизнеса
</a></li>
<div class="main_menu_content_list_sub_block">
<li>Оплата</li>
<li>О компании</li>
</div>
<li><a href="">
<div class="main_menu_content_list_sub_account"></div>Личный кабинет
</a></li>
</ul>
</div>
</div>
<div class="main_content">
</div>
You can draw the arrow with border properties and add to the corresponding submenu popup ::before for styling. Then, adjust the position of the arrow with top property for each submenu.
/* Add the following CSS configuration */
li:first-child ul.main_menu_content_list_submenu_popup::before {
top: 4.5rem;
}
li:nth-child(2) ul.main_menu_content_list_submenu_popup::before {
top: 11rem;
}
li:nth-child(3) ul.main_menu_content_list_submenu_popup::before {
top: 18rem;
}
ul.main_menu_content_list_submenu_popup::before {
position: absolute;
content: "";
border-color: transparent;
border-style: solid;
left: -0.5rem;
border-width: .5rem .5rem .5rem 0;
border-right-color: #F0F6F8;
}
.main {
font-family: PT Sans;
position: relative;
display: flex;
flex-direction: row;
min-height: 100%;
}
.main_menu {
display: flex;
flex-direction: column;
width: auto;
background-color: #38618C;
padding: 50px 0 0 0;
z-index: 1000;
}
.main_menu_content {
display: flex;
flex-direction: column;
position: sticky;
top: 50px;
width: 100%;
}
.main_menu_content_list {
display: flex;
flex-direction: column;
justify-content: space-between;
text-align: center;
height: 700px;
width: 250px;
}
.main_menu_content_list li {
list-style-type: none;
}
.main_menu_content_list a {
display: flex;
flex-direction: column;
align-items: center;
font-style: normal;
font-weight: normal;
font-size: 18px;
line-height: 23px;
color: #D7DFE8;
text-decoration: none;
}
.main_menu_content_list_sub_block {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 55px;
}
.main_menu_content_list_submenu {
justify-content: center;
position: absolute;
padding: 0;
margin: 0;
left: 100%;
height: 100vh;
background-color: #F0F6F8;
box-shadow: 5px 0px 20px rgba(0, 0, 0, 0.25);
top: -50px;
pointer-events: none;
opacity: 0;
transition: all linear 0.1s 0s;
width: 250px;
}
.main_menu_content_list li:hover .main_menu_content_list_submenu {
opacity: 1;
pointer-events: auto;
}
.main_menu_content_list_submenu_popup li:first-child {
margin: 50px 0 0 0;
}
.main_menu_content_list_submenu_popup li:not(:first-child) {
margin: 10px 0 0 0;
}
.main_menu_content_list li:hover > .main_menu_content_list_submenu {
display: flex;
}
.main_menu_content_list_submenu_popup a {
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 21px;
color: #38618C;
}
.main_menu_content_list_submenu_popup a:hover {
color: #38618C;
text-decoration: underline;
}
.main_menu_content_list_submenu_popup a:active {
color: #FF5964;
}
.main_content {
display: flex;
align-items: center;
flex-direction: column;
width: 100%;
max-width: 100%;
height: 100%;
}
/* Add the following CSS configuration */
li:first-child ul.main_menu_content_list_submenu_popup::before {
top: 4.5rem;
}
li:nth-child(2) ul.main_menu_content_list_submenu_popup::before {
top: 11rem;
}
li:nth-child(3) ul.main_menu_content_list_submenu_popup::before {
top: 18rem;
}
ul.main_menu_content_list_submenu_popup::before {
position: absolute;
content: "";
border-color: transparent;
border-style: solid;
left: -0.5rem;
border-width: .5rem .5rem .5rem 0;
border-right-color: #F0F6F8;
}
<div class="main">
<div class="main_menu">
<div class="main_menu_content">
<ul class="main_menu_content_list">
<li><a href="">
<div class="main_menu_content_list_int"></div>Интернет
</a>
<div class="main_menu_content_list_submenu">
<ul class="main_menu_content_list_submenu_popup">
<li>Подключение</li>
<li>Дополнительные услуги</li>
<li>Настройка соединения</li>
<li>Подключенные дома</li>
</ul>
</div>
</li>
<li><a href="">
<div class="main_menu_content_list_tv"></div>Телевидение
</a>
<div class="main_menu_content_list_submenu">
<ul class="main_menu_content_list_submenu_popup">
<li>Подключение</li>
<li>Новости</li>
<li>Акции</li>
<li>Аналоговое ТВ</li>
<li>Оборудование</li>
<li>Настройка каналов</li>
<li>Подключенные дома</li>
<li>Документы</li>
</ul>
</div>
</li>
<li><a href="">
<div class="main_menu_content_list_video"></div>Видеонаблюдение,<br>домофон
</a>
<div class="main_menu_content_list_submenu">
<ul class="main_menu_content_list_submenu_popup">
<li>Обслуживание</li>
<li>Установка</li>
<li>Заявка на ремонт</li>
<li>Подключение</li>
</ul>
</div>
</li>
<li><a href="">
<div class="main_menu_content_list_tvr"></div>ТВ Реклама
</a></li>
<li><a href="">
<div class="main_menu_content_list_intb"></div>Интернет для бизнеса
</a></li>
<div class="main_menu_content_list_sub_block">
<li>Оплата</li>
<li>О компании</li>
</div>
<li><a href="">
<div class="main_menu_content_list_sub_account"></div>Личный кабинет
</a></li>
</ul>
</div>
</div>
<div class="main_content">
</div>
</div>

Add rounded progress line to progress bar

I'm currently trying to program a progress bar:
.create-progress-bar {
padding: 0 !important;
margin: 25px 0;
display: flex;
}
.create-progress-bar li {
display: flex;
flex-direction: column;
list-style-type: none;
position: relative;
width: 33.3333333333%;
}
.create-progress-bar .step-inner-wrapper {
display: flex;
flex-direction: column;
align-items: center;
}
.create-progress-bar li span.step-title {
text-transform: uppercase;
font-weight: 600;
}
.create-progress-bar li span.step-icon {
font-size: 22px;
padding: 18px;
border: 3px solid;
border-radius: 100%;
margin-bottom: 6px;
font-weight: 600;
width: 26px;
text-align: center;
}
.create-progress-bar li:first-child {
align-items: flex-start;
}
.create-progress-bar li:nth-child(2) {
align-items: center;
}
.create-progress-bar li:last-child {
align-items: flex-end;
}
.create-progress-bar li::after {
content: '';
position: absolute;
width: 100%;
height: 3px;
background: #666666;
border-radius: 3px;
top: 31px;
left: -50%;
z-index: -1;
}
<ul class="create-progress-bar">
<li class="active">
<span class="step-inner-wrapper">
<span class="step-icon">✔</span>
<span class="step-title">Create</span>
</span>
</li>
<li>
<span class="step-inner-wrapper">
<span class="step-icon">✔</span>
<span class="step-title">Check</span>
</span>
</li>
<li>
<span class="step-inner-wrapper">
<span class="step-icon">✔</span>
<span class="step-title">Done</span>
</span>
</li>
</ul>
Now I've the problem that I can't get the progress bars styled between each elements. It should look like this depending on the class active in each li element:
Is there someone how has an idea how to get this done?
You can do this using flexbox and :before pseudo-elements. You can create line before every li element except the first one and if the li has active class you change border color and line color.
ul {
display: flex;
align-items: center;
justify-content: space-between;
list-style-type: none;
padding-left: 0;
margin-bottom: 50px;
}
li:not(:first-child) {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
}
li:not(:first-child):before {
flex: 1;
height: 1px;
background: black;
content: '';
margin: 0 10px;
}
li.active .step-inner-wrapper {
border-color: red;
color: red;
}
li.active:before {
background: red;
}
.step-inner-wrapper {
width: 50px;
height: 50px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid black;
border-radius: 50%;
position: relative;
}
.step-title {
position: absolute;
bottom: 0;
left: 50%;
transform: translate(-50%, 100%);
}
<ul class="create-progress-bar">
<li class="active">
<span class="step-inner-wrapper">
<span class="step-icon">✔</span>
<span class="step-title">Create</span>
</span>
</li>
<li>
<span class="step-inner-wrapper">
<span class="step-icon">✔</span>
<span class="step-title">Check</span>
</span>
</li>
<li>
<span class="step-inner-wrapper">
<span class="step-icon">✔</span>
<span class="step-title">Done</span>
</span>
</li>
</ul>
<ul class="create-progress-bar">
<li class="active">
<span class="step-inner-wrapper">
<span class="step-icon">✔</span>
<span class="step-title">Create</span>
</span>
</li>
<li class="active">
<span class="step-inner-wrapper">
<span class="step-icon">✔</span>
<span class="step-title">Check</span>
</span>
</li>
<li class="active">
<span class="step-inner-wrapper">
<span class="step-icon">✔</span>
<span class="step-title">Check</span>
</span>
</li>
<li>
<span class="step-inner-wrapper">
<span class="step-icon">✔</span>
<span class="step-title">Check</span>
</span>
</li>
<li>
<span class="step-inner-wrapper">
<span class="step-icon">✔</span>
<span class="step-title">Done</span>
</span>
</li>
</ul>
So I changed your CSS completely and made some minor changes to your HTML structure. This is my fiddle:
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.progress-bar {
display: flex;
width: 100%;
justify-content: space-around;
flex-flow: row;
align-items: center;
max-width: calc(100% - 40px);
margin: 0 auto;
}
.progress-bar>li:first-child {
width: auto;
}
.progress-bar>li:first-child .line {
display: none;
}
.progress-bar>li.active .tick {
border-color: red;
color: red;
}
.progress-bar>li.active .line {
background: red;
}
.progress-bar>li {
display: flex;
flex-flow: row;
width: 100%;
align-items: center;
}
.tick {
border-radius: 100%;
border: 5px solid black;
height: 30px;
width: 30px;
padding: 30px;
display: flex;
align-items: center;
justify-content: center;
font-size: 22px;
font-weight: 600;
position: relative;
}
.tick>span {
position: absolute;
top: 70px;
}
.line {
width: 100%;
height: 5px;
display: block;
background: black;
margin: 0 15px;
}
<ul class="progress-bar">
<li class="active">
<div class="line"></div>
<div class="tick">
✔<span>CREATE</span>
</div>
</li>
<li>
<div class="line"></div>
<div class="tick">
✔<span>CHECK</span>
</div>
</li>
<li>
<div class="line"></div>
<div class="tick">
✔<span>DONE</span>
</div>
</li>
</ul>
You will see that I removed the approach of using pseudo-classes, such as ::after, and added a div.line instead. In CSS I removed the first progress line with display: none instead of removing the div tag because it is easier to use dynamically since you don't have to care about removing the first line when prepending content. But you can also just remove it like here:
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.progress-bar {
display: flex;
width: 100%;
justify-content: space-around;
flex-flow: row;
align-items: center;
max-width: calc(100% - 40px);
margin: 0 auto;
}
.progress-bar>li:first-child {
width: auto;
}
.progress-bar>li.active .tick {
border-color: red;
color: red;
}
.progress-bar>li.active .line {
background: red;
}
.progress-bar>li {
display: flex;
flex-flow: row;
width: 100%;
align-items: center;
}
.tick {
border-radius: 100%;
border: 5px solid black;
height: 30px;
width: 30px;
padding: 30px;
display: flex;
align-items: center;
justify-content: center;
font-size: 22px;
font-weight: 600;
position: relative;
}
.tick>span {
position: absolute;
top: 70px;
}
.line {
width: 100%;
height: 5px;
display: block;
background: black;
margin: 0 15px;
}
<ul class="progress-bar">
<li class="active">
<div class="tick">
✔<span>CREATE</span>
</div>
</li>
<li>
<div class="line"></div>
<div class="tick">
✔<span>CHECK</span>
</div>
</li>
<li>
<div class="line"></div>
<div class="tick">
✔<span>DONE</span>
</div>
</li>
</ul>
Edit #1
Based on the comments, here is a version with a soft hyphen:
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.progress-bar {
display: flex;
width: 100%;
justify-content: space-around;
flex-flow: row;
align-items: center;
max-width: calc(100% - 40px);
margin: 0 auto;
}
.progress-bar>li:first-child {
width: auto;
}
.progress-bar>li.active .tick {
border-color: red;
color: red;
}
.progress-bar>li.active .line {
background: red;
}
.progress-bar>li {
display: flex;
flex-flow: row;
width: 100%;
align-items: center;
}
.tick {
border-radius: 100%;
border: 5px solid black;
height: 30px;
width: 30px;
padding: 30px;
display: flex;
align-items: center;
justify-content: center;
font-size: 22px;
font-weight: 600;
position: relative;
}
.tick>span {
position: absolute;
top: 70px;
max-width: 100px;
text-align: center;
}
.line {
width: 100%;
height: 5px;
display: block;
background: black;
margin: 0 15px;
}
<ul class="progress-bar">
<li class="active">
<div class="tick">
✔<span>CREATE­VERY­LONG­TEXT</span>
</div>
</li>
<li>
<div class="line"></div>
<div class="tick">
✔<span>CHECK</span>
</div>
</li>
<li>
<div class="line"></div>
<div class="tick">
✔<span>DONE</span>
</div>
</li>
</ul>
You could theoretically use hyphens: auto. But this has massive lack of browser support, as it can be seen here.
If you don't want the - dashes just use word-wrap: break-word;
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.progress-bar {
display: flex;
width: 100%;
justify-content: space-around;
flex-flow: row;
align-items: center;
max-width: calc(100% - 40px);
margin: 0 auto;
}
.progress-bar>li:first-child {
width: auto;
}
.progress-bar>li.active .tick {
border-color: red;
color: red;
}
.progress-bar>li.active .line {
background: red;
}
.progress-bar>li {
display: flex;
flex-flow: row;
width: 100%;
align-items: center;
}
.tick {
border-radius: 100%;
border: 5px solid black;
height: 30px;
width: 30px;
padding: 30px;
display: flex;
align-items: center;
justify-content: center;
font-size: 22px;
font-weight: 600;
position: relative;
}
.tick>span {
position: absolute;
top: 70px;
max-width: 100px;
text-align: center;
word-wrap: break-word;
}
.line {
width: 100%;
height: 5px;
display: block;
background: black;
margin: 0 15px;
}
<ul class="progress-bar">
<li class="active">
<div class="tick">
✔<span>CREATEVERYLONGTEXT</span>
</div>
</li>
<li>
<div class="line"></div>
<div class="tick">
✔<span>CHECK</span>
</div>
</li>
<li>
<div class="line"></div>
<div class="tick">
✔<span>DONE</span>
</div>
</li>
</ul>