I need help in writing a css fix for aligning the logo and navbar in desktop and mobile responsive modes. No options available in customize menu. Thanks in advance.
My Site
Theme Used
Problem SS1
Problem SS2
Use can use Display flex CSS. Example your website:
<div id="header-text-nav-wrap">
<div id="header-left-section">
<!-- your logo here -->
</div>
<div id="header-right-section">
<!-- your menu -->
<!-- your searh and other -->
</div>
</div>
<style>
#header-text-nav-wrap{
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
#header-logo-image img{
max-height: 60px;
width: auto;
margin: 0 auto;
text-align: center
}
#header-right-section{
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
}
.main-navigation,
.header-action{
padding-top: 0;
}
#media (max-width: 768px) {
.better-responsive-menu #header-text-nav-wrap{
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
}
.better-responsive-menu #header-logo-image {
float: none;
margin-bottom: 0;
margin-right: 0;
text-align: center;
}
.better-responsive-menu #header-right-section {
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
width: 100%;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
margin: 0;
-webkit-box-orient: horizontal;
-webkit-box-direction: reverse;
-ms-flex-direction: row-reverse;
flex-direction: row-reverse;
}
#header-right-section .header-action{
min-width: 200px;
padding-right: 15px;
}
}
</style>
Related
I am using CSS display: flex; to display them a certain way. In Chrome it looks perfect, like beautiful, but in IE the images go outside the element I have them in.
https://jsfiddle.net/m42k7Lk5/8/
.award-logos {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
box-orient: horizontal;
flex-direction: row;
-webkit-box-pack: center;
-moz-box-pack: center;
box-pack: center;
justify-content: center;
-webkit-box-align: center;
-moz-box-align: center;
box-align: center;
align-items: center
}
.award-logos .wrapper {
-webkit-box-flex: 1;
-moz-box-flex: 1;
box-flex: 1;
-webkit-flex: 1 1 auto;
flex: 1 1 auto;
padding: 10px 17px;
margin: 5px 0;
text-align: center;
border-right: 1px dotted #000
}
.wrapper img {
max-height: 150px
}
<div class="col-md-12 award-logos">
<div class="wrapper">
<img src="https://www.hsjaa.com/images/joomlart/demo/default.jpg">
</div>
<div class="wrapper">
<img src="https://www.hsjaa.com/images/joomlart/demo/default.jpg">
</div>
<div class="wrapper">
<img src="https://www.hsjaa.com/images/joomlart/demo/default.jpg">
</div>
<div class="wrapper">
<img src="https://www.hsjaa.com/images/joomlart/demo/default.jpg">
</div>
</div>
Can anyone help?
How can i make my footer stick to the bottom of the page with almost no content?
<footer>
<hr>
<p> © 2017 Sindre Berge <p>
</footer>
in CSS:
footer{
position:fixed;
bottom:0;
text-align: center;
width: 100%;
}
or you could inline it:
<footer style="position:fixed; bottom:0; text-align: center; width: 100%;">
<hr>
<p> © 2017 Sindre Berge <p>
</footer>
Using CSS:
<style>
footer {
width:100%;
position: fixed;
bottom: 0px;
text-align: center; /* This line is not needed but centers your text */
}
</style>
<footer>
<hr>
<p> © 2017 Sindre Berge <p>
</footer>
See it in action and play with it here: https://www.w3schools.com/code/tryit.asp?filename=FEO78PICTTQP
Or try the flex solution proposed by Sam. This will not cause the footer to not always be at the bottom of the browser view but instead at the bottom of the page.
Flex solution:
.flex-container {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-pack: start;
-moz-box-pack: start;
-webkit-justify-content: flex-start;
-ms-flex-pack: start;
justify-content: flex-start;
-webkit-align-content: stretch;
-ms-flex-line-pack: stretch;
align-content: stretch;
-webkit-box-align: start;
-moz-box-align: start;
-webkit-align-items: flex-start;
-ms-flex-align: start;
align-items: flex-start;
/*I give height 700px but can be adapted to a body being 100%*/
height:700px;
background:#cccccc;
}
.flex-content {
-webkit-box-ordinal-group: 3;
-moz-box-ordinal-group: 3;
-webkit-order: 2;
-ms-flex-order: 2;
order: 2;
-webkit-box-flex: 0;
-moz-box-flex: 0;
-webkit-flex: 0 1 100%;
-ms-flex: 0 1 100%;
flex: 0 1 100%;
-webkit-align-self: flex-end;
-ms-flex-item-align: end;
align-self: flex-end;
background:#ca33aa;
height:100px;
}
<div class="flex-container">
<div class="flex-content">
This is my footer
</div>
</div>
I personally like to use
footer{
position:absolute;
bottom:0;
width: 99%;
}
as I've found that sometimes the site will go haywire -- especially as far as the width is concerned, as by itself I am sometimes greeted by a nasty horizontal scroll bar at the bottom, despite everything fitting onto the screen nicely.
Block solution:
footer {
display:block;
position:fixed;
bottom:0;
}
Flex solution:
.flex-container {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-pack: start;
-moz-box-pack: start;
-webkit-justify-content: flex-start;
-ms-flex-pack: start;
justify-content: flex-start;
-webkit-align-content: stretch;
-ms-flex-line-pack: stretch;
align-content: stretch;
-webkit-box-align: start;
-moz-box-align: start;
-webkit-align-items: flex-start;
-ms-flex-align: start;
align-items: flex-start;
/*I give height 700px but can be adapted to a body being 100%*/
height:700px;
background:#cccccc;
}
.flex-content {
-webkit-box-ordinal-group: 3;
-moz-box-ordinal-group: 3;
-webkit-order: 2;
-ms-flex-order: 2;
order: 2;
-webkit-box-flex: 0;
-moz-box-flex: 0;
-webkit-flex: 0 1 100%;
-ms-flex: 0 1 100%;
flex: 0 1 100%;
-webkit-align-self: flex-end;
-ms-flex-item-align: end;
align-self: flex-end;
background:#ca33aa;
height:100px;
}
<div class="flex-container">
<div class="flex-content">
This is my footer
</div>
</div>
I am using flex for making a searchbar/input element stay centered and change width as the screen size changes.
This is my html:
<div class="flex-container">
<div class="flex-row">
<h1 class="brandname">Hello</h1>
</div>
<div class="flex-row">
<form>
<!-- <div class="search centered"> -->
<div class="search">
<div class="input-container">
<input type="text" name="query" class="searchbar" />
<button type="submit" class="search-button">Search</button>
</div>
</div>
</form>
</div>
</div>
and this is my css:
#import url('//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css');
.flex-container{
display: flex;
display: -webkit-flex;
align-items: center;
-webkit-align-items: center;
justify-content: center;
-webkit-justify-content: center;
-webkit-flex-direction: row;
flex-direction: row;
flex-wrap: wrap;
-webkit-flex-wrap: wrap;
}
.flex-row {
display: flex;
display: -webkit-flex;
justify-content: center;
-webkit-justify-content: center;
flex: 1;
-webkit-flex: 1;
}
form{
display: flex;
display: -webkit-flex;
justify-content: center;
-webkit-justify-content: center;
flex: 1;
-webkit-flex: 1;
}
.search{
display: flex;
display: -webkit-flex;
flex: 0 1 455px;
-webkit-flex: 0 1 455px;
}
.input-container{
display: flex;
display: -webkit-flex;
flex: 1;
-webkit-flex: 1;
min-width: 0;
}
.searchbar{
flex: 1;
-webkit-flex: 1;
min-width: 0;
}
.flex-container > .flex-row:first-child{
flex: 0 1 100%;
-webkit-flex: 0 1 100%;
}
.brandname {
position: relative;
font-size: 500%;
font-family: 'Lato', sans-serif;
color: #1f0e3e;
text-align: center;
margin-bottom: 30px;
margin-top: 5%;
}
body {
margin: 10px;
}
.input-container{
/*float: left;*/
/*display: block;*/
flex: 1;
-webkit-flex: 1;
outline-style: solid;
outline-color: #e3e3e3;
outline-width: 1px;
}
.searchbar{
margin-left: 5px;
}
.search button {
background-color: rgba(152,111,165,0.38);
background-repeat:no-repeat;
border: none;
cursor:pointer;
border-radius: 0px;
/*overflow: hidden;*/
outline-width: 1px;
outline-style: solid;
outline-color: #e3e3e3;
color: white;
}
.search input{
outline-width: 0px;
outline-style: none;
border-width: 0px;
}
and it works in chrome, ie edge and in this fiddle, but not in safari.
In Safari the searchbar goes above the .brandname element and to the right of it and takes a width of 150px.
any ideas on how to make this work in safari?
One thing that is not working is the the first flex row width of 100% is not working. In safari it is making the two felx-row elements be right next to each other and both of them together are taking 100% of the width.
I changed .flex-row css rules to:
.flex-row {
display: flex;
display: -webkit-flex;
justify-content: center;
-webkit-justify-content: center;
flex: 1;
-webkit-flex: 0 1 100%;
}
and changed the flex-row first child css rules to:
.flex-container > .flex-row:first-child{
flex: 0 1 100%;
-webkit-flex: 0 1 auto;
}
and then it works.
I thought about doing this after reading that flex-wrap is buggy in safari from this SO question which suggests that setting flex-wrap in safari is buggy
Always use the non-prefixed setting last in your CSS rules. In your first rule that would be:
.flex-container{
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
}
similar for all other rules.
The image (#avatar) not resized in height with flex, I tried to put his hand height and it works. But I would very much like is done with flex.
Don't know if this is my mistake or error flex ...
Add full sample code.
It works well only when I add this in #avatar:
- height: 10vh;
body{
margin: 0;
}
.startContainer {
width: 100vw;
height: 100vh;
position: absolute;
background-image: url("http://i.imgur.com/NVYPtGJ.jpg");
background-size: cover;
background-repeat: no-repeat;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-content: center;
-ms-flex-line-pack: center;
align-content: center;
-webkit-box-align: stretch;
-webkit-align-items: stretch;
-ms-flex-align: stretch;
align-items: stretch;
}
.startSideItem {
-webkit-box-ordinal-group: 1;
-webkit-order: 0;
-ms-flex-order: 0;
order: 0;
-webkit-box-flex: 0;
-webkit-flex: 0 1 30vw;
-ms-flex: 0 1 30vw;
flex: 0 1 30vw;
-webkit-align-self: auto;
-ms-flex-item-align: auto;
align-self: auto;
}
.startCenterItem {
-webkit-box-ordinal-group: 1;
-webkit-order: 0;
-ms-flex-order: 0;
order: 0;
-webkit-box-flex: 0;
-webkit-flex: 0 1 40vw;
-ms-flex: 0 1 40vw;
flex: 0 1 40vw;
-webkit-align-self: auto;
-ms-flex-item-align: auto;
align-self: auto;
}
.sideItem {
-webkit-box-ordinal-group: 1;
-webkit-order: 0;
-ms-flex-order: 0;
order: 0;
-webkit-box-flex: 0;
-webkit-flex: 0 1 auto;
-ms-flex: 0 1 auto;
flex: 0 1 auto;
-webkit-align-self: auto;
-ms-flex-item-align: auto;
align-self: auto;
}
.centerContainer {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-content: center;
-ms-flex-line-pack: center;
align-content: center;
-webkit-box-align: stretch;
-webkit-align-items: stretch;
-ms-flex-align: stretch;
align-items: stretch;
}
.topBottomCenterItem {
-webkit-box-ordinal-group: 1;
-webkit-order: 0;
-ms-flex-order: 0;
order: 0;
-webkit-box-flex: 0;
-webkit-flex: 1 1 30vh;
-ms-flex: 1 1 30vh;
flex: 1 1 30vh;
-webkit-align-self: auto;
-ms-flex-item-align: auto;
align-self: auto;
}
.centerItem {
-webkit-box-ordinal-group: 1;
-webkit-order: 0;
-ms-flex-order: 0;
order: 0;
-webkit-box-flex: 0;
-webkit-flex: 0 1 10vh;
-ms-flex: 0 1 10vh;
flex: 0 1 10vh;
-webkit-align-self: auto;
-ms-flex-item-align: auto;
align-self: auto;
}
#avatar {
display: block;
/*max-width:357px;
max-height:380px;
width: 100%;
height: auto;*/
max-width: 100%;
max-height: 100%;
}
.sideContainer {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-content: center;
-ms-flex-line-pack: center;
align-content: center;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.arrow {
display: inline-block;
max-width:45px;
max-height:75px;
width: 100%;
height: auto;
}
#rotateLeft {
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
#rotateDown {
-webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Jorge Beltrán Núñez</title>
<link rel="stylesheet" href="css/preload.css">
<link rel="stylesheet" href="css/index.css">
<link href='https://fonts.googleapis.com/css?family=Press+Start+2P' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="startContainer">
<div class="startSideItem sideContainer">
<div class="sideItem">
<img alt="" class="arrow" id="rotateLeft" src="http://i.imgur.com/XBejH02.png">
<p>Sobre mi</p>
</div>
</div>
<div class="startCenterItem centerContainer">
<div class="topBottomCenterItem"></div>
<div class="centerItem">
<img alt="" id="avatar" src="http://i.imgur.com/m5U9gy2.png">
</div>
<div class="topBottomCenterItem">
<p>Contacto</p>
<img alt="" class="arrow" id="rotateDown" src="http://i.imgur.com/XBejH02.png">
</div>
</div>
<div class="startSideItem sideContainer">
<div class="sideItem">
<p>PortFolio</p>
<img alt="" class="arrow" src="http://i.imgur.com/XBejH02.png">
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/jquery.gsap.min.js"></script>
<!-- <script src="js/preload.js"></script>-->
</body>
</html>
But this fixes is a patch. I do not have it in the parent and in the image (child): max-height: 100%;
Image inside flex-item ignores max-height:100% in chrome and firefox - (works in safari)
Try This-
.centerItem {
order: 0;
flex: 0 1 10vh;
overflow: hidden; /*NEW*/
align-self: auto;
}
I'm trying to create a "simple" information bar that should be displayed inline.
The bar consist of two divs, where the first contains all the required info (and is always visible) and the second shows information messages when they apply.
I have created a pen to demonstrate here.
My problem is that the content of the upper div is not always the same width and in some cases it overflows (which is a valid behavior based on my requirements since I always want it to be in one line). Thus when the screen gets shrinked enough the upper div overflows but the below keeps a width same as the screen width and does not follow the upper div's width.
What I want to achieve is make the below div have the same width as the upper even when the upper one overflows. Any ideas anyone?
Adding code here as well for reference:
HTML:
<h2> Shrink me to see than warning div is not the same width as the other one</h2>
<div id="TaskTimeBar">
<div id='main-wrapper'>
<div class="task-time-bar-content">
<div id="time-cell">
<div class='time-container'>
<i class="fa fa-clock-o"></i>21:12
</div>
</div>
<div id="active-task-bar-main-content">
<div><i class="fa fa-link"></i> #28125</div>
<div><i class="fa fa-info"></i> This can be a long text...</div>
<div><i class="fa fa-user"></i> Yo mama</div>
</div>
<div id="active-task-bar-buttons">
<div class="active-bar-button-wrapper">
<button>Stop</button>
</div>
<div class="active-bar-button-wrapper">
<button>Switch To #28192</button>
</div>
</div>
</div>
</div>
<div class="active-task-bar-information">This is an information message</div>
</div>
CSS:
#TaskTimeBar {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-box-direction: normal;
-webkit-box-orient: vertical;
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-flex-wrap: wrap;
-moz-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
#main-wrapper {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
}
.task-time-bar-content {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
padding: 5px;
}
#time-cell {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
font-weight: bold;
font-size: 22px;
}
.time-container {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
-moz-justify-content: center;
justify-content: center;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
}
.time-container i {
padding-right: 5px;
}
#active-task-bar-main-content {
padding: 0 10px;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-box-pack: space-around;
-ms-flex-pack: space-around;
-webkit-justify-content: space-around;
-moz-justify-content: space-around;
justify-content: space-around;
}
#active-task-bar-main-content div {
padding: 0 10px;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
}
#active-task-bar-buttons {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
padding: 0 10px;
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
-webkit-box-pack: end;
-ms-flex-pack: end;
-webkit-justify-content: flex-end;
-moz-justify-content: flex-end;
justify-content: flex-end;
}
.active-bar-button-wrapper {
line-height: 28px;
margin-right: 5px;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
}
.active-task-bar-information {
background-color: #ffa500;
color: #f3ebf8;
border: thin solid #808080;
border-top: none;
text-align: center;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
-moz-justify-content: center;
justify-content: center;
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
}
Edit:
Let me explain a little bit more based on the div's ids as asked in the comments.
I hava a #TaskTimeBar that contains two divs inside, #main-wrapper and #active-task-bar-information. Requirements are as follows:
#main-wrapper should always be in one line
#active-task-bar-information should always have the same width as #main-wrapper and be underneath it.
The problem is that when the screen becomes small the contents of #main-wrapper overflow and exceed the screen width but #active-task-bar-information does not follow. If you play around with the window width in the linked pen you will see the effect.
Just to make sure I got this right:
main-wrapper never actually wraps it's content, therefore it overflows.
active-task-bar-information content actually wraps and never exceeds the viewport.
main-wrapper's behavior is correct.
active-task-bar-information's behavior is not correct. It should behave as it's sibling #main-wrapper.
Going by these criterions I think I got it. Try this:
html { box-sizing: border-box; font: 16px/1.5 Consolas; }
body { width: 100%; min-width: 60em; height: auto; }
*, *:before, *:after { box-sizing: inherit; margin: 0; padding: 0; border: 0; }
#TaskTimeBar {
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -moz-inline-box;
display: -moz-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-box-direction: normal;
-webkit-box-orient: vertical;
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-flex-wrap: nowrap;
-moz-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-pack: stretch;
-ms-flex-pack: stretch;
-webkit-justify-content: stretch;
-moz-justify-content: stretch;
justify-content: stretch;
}
#main-wrapper {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
}
.task-time-bar-content {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
padding: 5px;
}
#time-cell {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
font-weight: bold;
font-size: 22px;
}
.time-container {
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -moz-inline-box;
display: -moz-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
-moz-justify-content: center;
justify-content: center;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
}
.time-container i {
padding-right: 5px;
}
#active-task-bar-main-content {
padding: 0 10px;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
-webkit-box-pack: space-around;
-ms-flex-pack: space-around;
-webkit-justify-content: space-around;
-moz-justify-content: space-around;
justify-content: space-around;
}
#active-task-bar-main-content div {
padding: 0 10px;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
}
#active-task-bar-buttons {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
padding: 0 10px;
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
-webkit-box-pack: end;
-ms-flex-pack: end;
-webkit-justify-content: flex-end;
-moz-justify-content: flex-end;
justify-content: flex-end;
}
.active-bar-button-wrapper {
line-height: 28px;
margin-right: 5px;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-shrink: 0;
-moz-flex-shrink: 0;
-ms-flex-negative: 0;
flex-shrink: 0;
}
.active-task-bar-information {
background-color: #ffa500;
color: #f3ebf8;
border: thin solid #808080;
border-top: none;
text-align: center;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
-moz-justify-content: center;
justify-content: center;
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-moz-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
}
To get more accurate results I reset everything to border-box sizing, zeroed all margins, paddings, and borders. That's optional.
I changed how the parent flexbox (TaskTimeBar) contents are kept since main-wrapper and active-task-bar-information are siblings. The changes are as follows:
#TaskTimeBar {...
.....
-webkit-flex-wrap: nowrap;
-moz-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-pack: stretch;
-ms-flex-pack: stretch;
-webkit-justify-content: stretch;
-moz-justify-content: stretch;
justify-content: stretch;
}
TaskTimeBar (the parent) stretches it's children (main-wrapper and active-task-bar-information), past the viewport due to the justify property stretch and the flex-wrap property nowrap. As a side note, active-task-bar-information was always 2px shorter than main-wrapper until I did that reset and now they measure the same width in any sized viewport (as far as I'm able to determine).
Hopefully I understood your question properly and gave you appropriate advice.
EDIT: While I was fulfilling a request for a [demo][1], I added inline-flex to all three divs. Details are provided with the demo. Below are screenshots illustrating the 2 divs equal widths.
In this fiddle I've taken #zer00ne's code, and tried to simplify the situation, by keeping only the outer div a flex-box, instead of managing a hierarchy of flex-boxes. I've kept the inner divs in line with display: inline and white-space: nowrap. Is seems to achieve the desired result.