when I add position fixed the header goes down from its normal position ?
-
Hallo,
yesterday I asked question about the gap between 2 classes. I understand now that I had too many containers and it was very complicated.
so I started from scratch to create header with flex to see where the problem lies.
I am using 2 containers of flex in the first-header class.
this is HTML:
<body <?php body_class(); ?>> <?php wp_body_open(); ?> <div id="page" class="site"> <a class="skip-link screen-reader-text" href="#primary"><?php esc_html_e( 'Skip to content', 'auto-repair-service' ); ?></a> <header id="masthead" class="site-header"> <div id="first-header" class="flex-container"> <div class="info"> Hello </div> <div class="first-header-second-section"> <div class="title">Hello Hello </div> <div class="info2">Klanten Beoordeling 9.2/10</div> <div class="info3">Vooraf prijs opgave</div> </div> </div> </header>
this is CSS:
#first-header{ width:100%; height:65px; background:#45accb; border:0.01px solid #45accb; z-index:9999; display:flex; flex-direction:column; position:fixed; } .info { width:96%; margin-right:4%; display:flex; justify-content:flex-end; color:white; font-size:1.2rem; } .first-header-second-section { width:100%; display:flex; flex-direction:row; } .title{ width:33.333%; font-size:1.2rem; color:#ffd978; display:flex; justify-content:flex-start; margin-left:4%; } .info2{ width:33.333%; font-size:1.2rem; color:#ffd978; display:flex; justify-content:center; align-items:center; } .info3{ width:33.333%; font-size:1.2rem; color:#ffd978; display:flex; justify-content:flex-end; align-items:center; margin-right:4%; }
everything is ok untill I add position:fixed in the first-header (class)
when I add this (position:fixed) code the first-header goes few rem down from its normaal position. when I remove it the first-header goes back to its normaal position.
I see this problem is coming from the 2 flex containers I am using in the first-header.
my aim is to have 2 rows (in flex)in the header.
how I can solve this problem?
thanks
The page I need help with: [log in to see the link]
- The topic ‘when I add position fixed the header goes down from its normal position ?’ is closed to new replies.