Flex keeps on resizing itself in Firefox - html

I'm using Vis.js to create diagrams. Relevant code:
.defaultSection {
border: 1px solid #bbbbbb;
padding-bottom: 0px;
margin: 5px;
width: calc(100% - 10px);
}
.overflowHidden {
overflow: hidden;
overflow-x: hidden;
overflow-y: hidden;
}
.flexParent {
display: flex;
justify-content: space-between;
padding: 2px;
}
.flexParentInvisible {
display: flex;
justify-content: space-between;
}
.flexElement {
flex-basis: 100%;
}
.flexPanel {
flex-basis: 100%;
}
.roundedCorners {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.3s;
border-radius: 5px;
margin: 5px;
}
<div data-panes="true">
<div id="Tab-ta6f7ijb-Content" class="active">
<div class="defaultSection roundedCorners overflowHidden">
<div class="defaultHeader" style="text-align:center;background-color:#00bfff"><a name="Test" style="color: #ffffff;">Test </a><a id="show_505656775" href="javascript:void(0)" onclick="show('505656775');" style="color: #ffffff; display:none;">(Show)</a><a id="hide_505656775" href="javascript:void(0)" onclick="hide('505656775');"
style="color: #ffffff; display:none;">(Hide)</a></div>
<div id="505656775" class="flexParent flexElement overflowHidden">
<div id="505656775" class="flexParent flexElement overflowHidden collapsable">
<div id="Diagram-hvardq4p" class="diagram"></div>
</div>
</div>
</div>
</div>
</div>
Full code: https://codepen.io/MadBoyEvo/pen/XWmbZra
It works fine in Chrome, Edge, IE and even Firefox with one problem. In firefox, the section where diagram is located keeps on resizing itself over and over. I'm sure this is my mistake with CSS but whatever I try to fix it doesn't work.

The diagram is contained in a <canvas> element. That element has two height values assigned, both as inline styles:
height: 100%, and
height="484" (or whatever value it happens to have at the moment).
Once you remove the height: 100% the rolling expansion stops.

Author of Vis.js provided me with a tip: https://github.com/visjs/vis-network/issues/628
<div Class="diagram" Style="position:relative">
<div style="position:absolute" id="Diagram-w5gcskfb" class="diagram"></div>
</div>
This solves it for me.

Related

Equal card size on mobile resolution

I have a problem with the size of the cards. On the Desktop side are ok, but on a lower resolution begin to be no longer equal. How should I proceed in this situation? I'm not an expert in css, I work on the backend but I would like in the future to have a correct solution how I could solve something like.
html
<div class="proditem">
%PROMO%
<div class="proditem_cover">
%COVER%
%promo_period%
</div>
<h3 class="protitem_title">
%TITLE%
</h3>
<div class="protitem_price">
%PRICE% eur %price_euro%
</div>
<div class="detalils"><a class="button1" href="%LINK%">Details</a></div>
</div>
a {
text-decoration: none;
color: inherit;
font-size:16px;}
.list_prod .proditem {
height: auto;
max-height: initial;
float: none;
display: inline-block;
margin-bottom: 10px;
vertical-align: top;
transition: 0.3s;
width: 40%;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
padding: 2px 16px;
border: 0 !important;
border-radius: 1rem;
.proditem img {
width: 170px;
height: 170px;
max-width: 10vw;
max-height: 10vw;
/* object-fit: cover; */
}
image
As far as I can see, they decrease in size because they don't have the same information, depending on the text and image if they're not equal. How can I make them equal regardless of the information they have?
Maybe you can try to create wrapper class like :
<div style="width:100%; height:auto; display:flex; justify-content:flex-start;" class="wrapper">
<div style="width:50%; height:100%; " class="content"> <div/>
<div style="width:50%; height:100%; class="content"> <div/>
<div/>
This just a simple example to give you a some styling or aligning tricks. Try and write me if its not-proper code for you.

HTML/CSS - Display:inline not working

I need some help with my website. I am struggling to achieve that three pictures are shown as "display:inline", which means next to each other and not under each other.
I can't find my mistake and would welcome and hints.
.trikot {
max-width: 1050px;
height: 200px;
border: 2px solid rgba(255, 255, 255, 0.9);
border-radius: 10px;
margin-left: 10px;
margin-top: 10px;
display: inline;
}
.trikotset {
margin-top: 15px;
margin-left: 10px;
height: 150px;
}
#buy_button {
background-color: #9c1737;
width: 100px;
display: block;
margin-left: 35px;
}
<section class="trikot">
<div id="trikot1">
<img class="trikotset" src="img/trikot.jpg">
<button id='buy_button' type='button'>Jetzt Kaufen</button>
</div>
<div id="trikot2">
<img class="trikotset" src="img/hose.jpg">
<button id='buy_button' type='button'><a href=>Jetzt Kaufen</button>
</div>
<div id="trikot3">
<img class="trikotset" src="img/traningsanzug.jpg">
<button id='buy_button' type='button'><a href=>Jetzt Kaufen</button>
</div>
</section>
You would find floats much more reliable for this type of situation because I don't see you need vertical positioning.
EDIT : remember to include clearfix! Floated elements are similar to absolute, they are taken from the document flow.
The images are inside the containers #trikot1, #trikot2, #trikot3. You need to define display: inline-block; for those containers:
#trikot1, #trikot2, #trikot3 {
display: inline-block;
}

Align the bottom of images on different columns(Bootstrap)

On my website I have 3 bootstrap columns and each has a photo at the end. The problem is that the titles have different lengths and because of that when I resize the browser (at 1100px width) one of the pictures and the paragraph above it shift a little bit lower then the other 2. Is it possible to align the photos and pragraphs at the bottom and the title at the top?
Here is a JsFiddle of the problem I have
I don't now why but in JsFiddle the columns are all in one column and not multiple (like on a mobile device) but maybe if you save it and then open it in your browser you can see the problem.
HTML:
<div class="container-fluid">
<div class="row ">
<div class="col-md-4 column">
<center>
<h1>Babababababababababababababa</h1>
<p>2013 - Now</p>
<div>
<div class="container-images"> <img class="image" src="https://iso.500px.com/wp-content/uploads/2016/05/stock-photo-93725859-1500x1000.jpg">
<div class="over">
<p class="title">aaa</p>
<p class="rayal">aaaaaa</p>
</div>
</div>
</div>
</center>
</div>
<div class="col-md-4 column">
<center>
<h1>Bababababababababababababababababa</h1>
<p>2009 - 2013</p>
<div class="container-images"> <img class="image" src="https://iso.500px.com/wp-content/uploads/2016/05/stock-photo-93725859-1500x1000.jpg">
<div class="over">
<p class="title">aaa</p>
<p class="rayal">aaaaa</p>
</div>
</center>
</div>
<div class="col-md-4 column">
<center>
<h1>Babababababababababababababab</h1>
<p>2007 - 2009</p>
<div class="container-images"> <img class="image" src="https://iso.500px.com/wp-content/uploads/2016/05/stock-photo-93725859-1500x1000.jpg">
<div class="over">
<p class="title">aaa</p>
<p class="rayal">aaaaa</p>
</div>
</center>
</div>
</div>
</div>
CSS:
.container-images {
height: 300px;
width: 75%;
overflow: hidden;
display: flex;
/* align-items: center;*/
justify-content: center;
position: relative;
border-radius: 100px;
}
.image {
width: 100%;
height: 100%;
position: relative;
z-index: 1;
background-size: cover;
border-radius: 100px;
display: block;
float: left;
box-sizing: border-box;
-moz-box-sizing: border-box;
margin-bottom: 50px;
}
.over {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
z-index: 2;
background: rgba(0, 0, 0, 0.2);
transition: all 0.3s ease-in-out;
border-radius: 100px;
}
.title {
margin-top: 100px;
color: white;
transition: all 0.5s ease-in-out;
font-family: RobotoSlab-Regular;
opacity: 0;
}
.rayal {
opacity: 0;
color: white;
transition: all 0.5s ease-in-out;
font-family: RobotoSlab-Regular;
}
.over:hover {
background: rgba(0, 0, 0, 0.5);
}
.over:hover .title {
margin-top: 0;
opacity: 1;
}
.over:hover .rayal {
opacity: 1;
}
This is a good example for flexbox.
Here's an updated example of your plunker:
https://jsfiddle.net/eqcyyae9/9/
A few notes on this:
I removed your <center> tags. These are depreciated, and it's not a good practice to use them (as described here). The same effect can be achieved using the Bootstrap center-block CSS class.
I removed the flexbox properties on your container-images class. The centering you were doing in that case is handled by center-block, and as a personal preference I only use Flexbox when necessary so my CSS degrades as gracefully as possible for older browsers.
I added a container-content class which does have flexbox on it. Using the space-between attribute with the flex-direction: column allows your content to take up the designated space (570px in this example). Your header will always stick to the top, and your image will stick to the bottom and any extra space will end up in-between (thus, space-between). There's a really good article on this here if you have more interest in looking into it.
As a side note, plunker asks that you add all file dependencies to the "External Resources" section rather then directly to the HTML. That's why you weren't seeing your Bootstrap styles come through.

Is it bug in WebKit with min-width?

I was struggling with weird rendering of my web site header for hour or so and it looks like there is the bug in WebKit (e.g. latest Chrome). It is bug? Or am I missing something?
Here is the http://jsfiddle.net/y415st6s/
I expect a separator to appear between Site Title and Page Title, but get only its border overflowing over the site title. I'm using min-width to set width of block with "Site title" and I noticed it works fine at least in FireFox and IE. In WebKit it looks like inner padding is not accounted in external dimensions of the block with min-width. The problem seems to disappear when 'width' is also set to the same value (see line #28 in jsfiddle CSS).
According to https://developer.mozilla.org/en-US/docs/Web/CSS/min-width setting just min-width should override 'width' too, so it seems I'm doing it the right way.
Staff for copy/pasting ...
HTML
<header class="siteHeader hstackpanel">
<div>
<div class="siteHeader__logoArea hstackpanel">
<div class="siteHeader__logoIcon">
<img src="http://static.flaticon.com/png/16/1394.png">
</div>
<div class="siteHeader__logoText hstackpanel-autofit">Site Title</div>
<div class="siteHeader__logoButtons">
<img src="http://static.flaticon.com/png/16/9916.png">
<img src="http://static.flaticon.com/png/16/57164.png">
</div>
</div>
</div>
<div>
<!-- box with blue border -->
<div class="siteHeader__splitter"></div>
</div>
<div class="hstackpanel-autofit">
<div class="siteHeader__titleArea hstackpanel">
<div class="hstackpanel-autofit">
<div class="siteHeader__titleAreaText hstackpanel hstackpanel-autofit">
<span class="siteHeader__pageTitleText">Current Page Title</span>
</div>
</div>
<div>
<div class="siteHeader__titleAreaButtons hstackpanel"></div>
</div>
</div>
</div>
</header>
CSS
* {
box-sizing: border-box;
}
.hstackpanel {
display: table;
width: 100%;
}
.hstackpanel > div {
display: table-cell;
position: relative;
vertical-align: middle;
padding: 2px;
}
.hstackpanel > div:not(.hstackpanel-autofit) {
white-space: nowrap;
width: 0.01px;
}
img {
width: 16px;
height: 16px;
}
.siteHeader {
background: yellow;
n_height: 24px;
}
.siteHeader__logoArea {
min-width: 270px;
/* width: 270px; */
padding: 4px 8px;
background: green;
}
.siteHeader__splitter {
border: 1px solid blue;
width: 8px;
height: 24px;
}
.siteHeader__titleArea {
padding: 4px 8px;
background: green;
}
Chrome and Safari do not support the min-width property on table elements. They will, however, respect min-width when applied to table cells. You're applying display: table to the .htstackpanel div.

HTML & CSS Line up right aligned elements inside and outside of a (sometimes) scrollable div

i have a legend for a graph that sometimes is scrollable and sometimes isn't.
Unfortunately when the scrollbar shows up, it pushes all of the elements over to the left a bit. So they don't line up with a total (outside the scrollable area)
Example: http://jsfiddle.net/3sKVR/
A simple answer would be to just set a fixed width, but unfortunately, it has to be responsive.
Also, i can't use custom scrollbars to maintain consistency with the rest of the site and also bring down page-load times.
Any help would be greatly appreciated (with internet points!)
Cut down version of code:
HTML:
<div id="legend_cont">
<div id="legend_list">
<div id="legend">
<div class="legend_row">
<div class="legend_cell">
<div class="legend_colour" style="background-color:#ffb100"></div>
</div>
<div class="legend_cell">Merch G</div>
<div class="legend_cell legend_value">$1423.24</div>
</div>
<div class="legend_row">
<div class="legend_cell">
<div class="legend_colour" style="background-color:#ed5929"></div>
</div>
<div class="legend_cell">Merch L</div>
<div class="legend_cell legend_value">$1351.07</div>
</div>
<div class="legend_row">
<div class="legend_cell">
<div class="legend_colour" style="background-color:#3f9c35"></div>
</div>
<div class="legend_cell">Merch N</div>
<div class="legend_cell legend_value">$1194.90</div>
</div>
<div class="legend_row">
<div class="legend_cell">
<div class="legend_colour" style="background-color:#009bbb"></div>
</div>
<div class="legend_cell">Merch T</div>
<div class="legend_cell legend_value">$1188.14</div>
</div>
</div>
</div>
<div id="legend_total">Total:<span id="legend_total_value">$0.00</span>
</div>
</div>
CSS:
#legend_cont {
height: 100%;
border-left: 2px solid #ADADAD;
width: 40%;
float: right;
}
#legend_list {
height: 169px;
overflow: auto;
margin: 20px 4% 20px 7%;
}
#legend {
display: table;
width: 90%;
}
.legend_row {
display: table-row;
}
.legend_cell {
display: table-cell;
padding: 5px;
vertical-align: middle;
}
.legend_colour {
width: 10px;
height: 20px;
background-color: #c1c1c1;
border-radius: 3px;
}
.legend_value {
text-align: right;
}
#legend_total {
height: 50px;
line-height: 50px;
width: 88%;
border-top: 1px solid;
margin-left: 8%;
}
#legend_total_value {
float: right;
padding-right: 5px;
}
1) Make sure there is always a scroll bar
CSS
#legend_cont {
overflow-y: scroll;
}
2) Use js to grab the variable width of the scrollbar (example here)
3) Set the padding-right in #legend_total_value equal to that variable in jquery.
JS
$('#legend_total_value').css('padding-right', wScroll);​
Try applying padding-right to compensate for the size of scrollbar when it's not there and position the total accordingly.
#legend_list {
height: 169px;
overflow: auto;
margin: 20px 4% 20px 7%;
padding-right:15px;
}
Demo