How can I override the flex-xs breakpoint when printing? - html

I have a row of checkboxes, that when the screen size is small enough (less than 600px), collapse into columns.
This is fine, but now when I attempt to print this document, the mobile breakpoints activate, and stack up in columns, rather than in rows that I want them in.
Here is the min example of the html I have.
<div id="printCheckbox" flex="100" layout="row" layout-xs="column" layout-wrap>
<div flex="33" flex-xs="100" >
<md-checkbox>1</md-checkbox>
</div>
<div flex="33" flex-xs="100" >
<md-checkbox>2</md-checkbox>
</div>
<div flex="33" flex-xs="100" >
<md-checkbox>3</md-checkbox>
</div>
<div flex="33" flex-xs="100" >
<md-checkbox>4</md-checkbox>
</div>
<div flex="33" flex-xs="100" >
<md-checkbox>5</md-checkbox>
</div>
<div flex="33" flex-xs="100" >
<md-checkbox>6</md-checkbox>
</div>
</div>
I can obviously remove the mobile support to have the print view function correctly, however I am wondering if I can override the flex-xs values in css.
Here is what I am attempting to do in css
#media only print {
#printCheckbox{
[flex-xs="100"] {
// Make them 33?
}
}
}
So is it possible to supply a different value to the flex-xs in css? Or disable the mobile breakpoints completely?

I didn't really do what I wanted to, but I found a workaround myself.
I made my CSS this for the parent container of the checkboxes
#media screen and (max-width: 600px) {
.printCheckBoxContainer{
flex-direction: column;
}
.printCheckBox{
flex-direction: column;
flex-basis: 100%;
}
}
#media only print {
.printCheckBoxContainer{
align-items: center;
flex-wrap: wrap;
flex-direction: row;
}
.printCheckBox{
align-self: center;
flex-basis: 33%;
}
And then changed my HTML to look like
<div class="printCheckBoxContainer" class="verify-identity" flex="100" layout="row" layout-wrap>
<div class="printCheckBox" flex="33">
<md-checkbox></md-checkbox>
</div>
<div class="printCheckBox" flex="33">
<md-checkbox></md-checkbox>
</div>
<div class="printCheckBox" flex="33">
<md-checkbox></md-checkbox>
</div>
<div class="printCheckBox" flex="33">
<md-checkbox></md-checkbox>
</div>
<div class="printCheckBox" flex="33">
<md-checkbox></md-checkbox>
</div>
<div class="printCheckBox" flex="33">
<md-checkbox></md-checkbox>
</div>
</div>
So I kept the default breakpoints, then just specified the flex-basis in css based on the media queries. Basic stuff, but it works!
Unless I get a better answer within a couple of days, I will accept my own answer.

Related

How do I change the order of a container in mobile with this code?

How do I change the order of this code in mobile?
Currently on desktop <div class="grid4-12">(left) and <div class="grid8-12">(right) are stacked to each other.
How do I change the code in responsive such that <div class="grid8-12"> is on top and <div class="grid4-12"> is at the bottom?
Code below
<div class="card-content-lg" style=" background: #ffffff;">
<div class="grid4-12">
<div class="quote-wrapper test">
<div class="quote-col1 test">
<div class="quote-image"><img alt="Image1" src="/images" /></div>
</div>
<div class="quote-col2 test2">
<div class="quote-text">This is only test</div>
</div>
<div class="quote-col3">
<div><img alt="ABC" src="/images" /></div>
</div>
</div>
</div>
<div class="grid8-12">
<div class="card-content-md">
<h2 class="abc">This is h2 text</h2>
<p>This is a test.</p>
</div>
</div>
</div>
You can give the parent class (.card-content-lg) a display value of flex, with flex-direction set to column. Then, on the "second" / "right" element, give it a value of "order: -1;". Then, change the value of flex-direction to "row" on larger viewports, and change the order back to 1.
.card-content-lg {
display: flex;
flex-direction: column;
}
#media all and (min-width: 640px) {
.card-content-lg {
display: flex;
flex-direction: row;
}
}
.grid4-12, .grid8-12 {
background: gray;
min-height: 6rem;
margin: 1rem;
padding: 1rem;
color: white;
}
.grid8-12 {
order: -1;
}
#media all and (min-width: 640px) {
.grid8-12 {
order: 1;
}
}
<div class="card-content-lg" style=" background: #ffffff;">
<div class="grid4-12">
<div class="quote-wrapper test">
<div class="quote-col1 test">
<div class="quote-image"><img alt="Image1" src="/images" /></div>
</div>
<div class="quote-col2 test2">
<div class="quote-text">This is only test</div>
</div>
<div class="quote-col3">
<div><img alt="ABC" src="/images" /></div>
</div>
</div>
</div>
<div class="grid8-12">
<div class="card-content-md">
<h2 class="abc">This is h2 text</h2>
<p>This is a test.</p>
</div>
</div>
</div>
make card-content-lg a flexbox and use media queries to reverse direction using flex-direction: row-reverse
add css of your code so we can attach a working sample as well.

Angular - Show fields side by side

I am trying to show the fields in the angular side by side no matter what I do it is still showing like below
And below is my html component
<div id="report-prj-search">
<div class="dx-fieldset" >
<div class="dx-field">
<div class="dx-field-label">ShipTo Account</div>
<div class="dx-field-value">
<dx-select-box [dataSource]="ShipmentList" displayExpr="customer_shipto_name" (onValueChanged)="onValueChanged($event)" ></dx-select-box>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Purchase Order</div>
<div class="dx-field-value">
<dx-select-box [dataSource]="purchaseOrder" displayExpr="customer_purchase_order" ></dx-select-box>
</div>
</div>
<div class="dx-field">
<dx-button (onClick)="click($event)">Filter</dx-button>
</div>
</div>
</div>
I've refactored your HTML slightly so that you can use CSS Flexbox:
<div id="report-prj-search">
<div class="dx-fieldset flex-column">
<div class="flex-row-container">
<div class="dx-field flex-row">
<div class="dx-field-label">ShipTo Account</div>
<div class="dx-field-value">
<select></select>
</div>
</div>
<div class="dx-field flex-row">
<div class="dx-field-label">Purchase Order</div>
<div class="dx-field-value">
<select></select>
</div>
</div>
</div>
<div class="dx-field">
<button (onClick)="click($event)">Filter</button>
</div>
</div>
</div>
Use Flexbox in your CSS:
.dx-fieldset.flex-column {
display: flex;
flex-direction: column;
}
.flex-row-container {
display: flex;
flex-direction: row;
}
.dx-field.flex-row {
display: flex;
flex-direction: row;
}
Here's the flexbox guide that I've used several times in the past:
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
You need to style the component as some sort of component that is in the same line, such as display: inline or a wrapper which is display: flex and flex-direction: row or display: inline-block!

Why is flexbox creating unused space below my content?

I have some slides where I'm trying to equally space content using display: flex but it's adding a large empty area below my content and above the navigation.
When the screen shrinks to the mobile size the empty area becomes much more apparent.
I have no idea why it's doing this, or why switching display: flex to display:table messes things up even more.
After spending two days I've come for some guidance.
Here's a test link to what I have. Click on 1 - 4 to get to a screen using flex.
<div class="slide" id="slide-one" data-slide="1">
<p class="deck">You don’t have to wait until bad weather is imminent to prepare for a power outage. Take some time to get organized with these tips.</p>
<div class="row">
<div class="section" id="emergency-kit">
<div class="rollover center">
<div class="button-container">
<div class="button"></div>
</div>
<div class="text">Create an Emergency Kit</div>
</div>
<div class="container">
<img src="img/emergency-kit.png" alt="" />
</div>
</div>
<div class="section" id="food-prep">
<div class="rollover center">
<div class="button-container">
<div class="button"></div>
</div>
<div class="text">Prep Your Food</div>
</div>
<div class="container">
<img src="img/fridge.png" alt="" />
</div>
</div>
</div>
</div>
.row {
display: flex;
width:100%;
flex-direction: row;
margin-top: 20px;
}
#emergency-kit {
width:40%;
display: inline-block;
.container {
max-width: 263px;
}
}
#food-prep {
width:40%;
display: inline-block;
.container {
max-width: 167px;
}
}
Also, using flexslider for the slideshow animations.
The source of the gap has nothing to do with flexbox. Your flex container (.row) is nested within a larger container.
div.row
... is a descendant of div.flex-viewport
... which takes up all the height to the bottom navbar.
On the smaller screen, div.row isn't even a flex container anymore. It's switched to a block element:
Possible options for closing the gap:
Reduce the height of one of the containers
Define heights for all container elements between .flex-viewport and .row
Apply display: flex to all containers, so children can expand the full height of their parent

Swaping divs with pull and push

I have been reading a lot of documentation but I cannot succeed re-arranging some divs order. This is my code
<div class="container">
<div class="row">
<div class="col-md-11">
<div class="slider">
The slider
</div>
</div>
<div class="col-md-5">
<nav class="main-menu">
The Menu
</nav>
</div>
</div>
</div>
I want the menu to be over the slider (both with 16 column size) when screen enters sm. Is it possible?
Use flexbox:
.row {
display: flex;
flex-direction: column;
}
#media (max-width: 500px) {
.row > div:first-child {
order: 2;
}
}
http://codepen.io/antibland/pen/aNRZRJ

Bootstrap column to extend out side of the container

im trying to use bootstrap for a site, but what i am trying to achieve to have to columns within a row col-sm-6. Where i want one column to be in an ordinary container and the other to have container fluid effect.
So it would one column as normal and the other column as full width. So far this has been difficult to do:
<div class="container">
<div class="row">
<div class="col-sm-6 first">
</div>
<div class="col-sm-6 second">
</div>
</div>
</div>
http://jsfiddle.net/8fyjtn09/
i think i figured it out, instead of using a normal container i would have to use container fluid as i said before but just an offset
<div class="container-fluid">
<div class="row">
<div class="col-sm-offset-2 col-xs-4 first">
</div>
<div class="col-sm-6 second">
</div>
</div>
</div>
Do you know flex-box layout in CSS ?
As i understand your question, i believe that on wider screens you want to have first column fixed and second column should be responsive. And for a smaller screen you want the default bootstrap behaviour. If this is what you are looking for, i have created a simple fiddle. Please check that and let me know if this is helpful.
Here is the link : https://jsfiddle.net/YameenYasin/7zaxx06z/23/
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<div class="container">
<div class="row flexbox">
<div class="first">
</div>
<div class="second">
</div>
</div>
</div>
.flexbox {
display: -webkit-flex;
-webkit-flex-flow: row; // Children elements will be in rows
-webkit-flex-wrap: wrap;
width: 100%;
}
.first
{
border:1px solid red;
height:50px;
width:200px;
}
.second{
border:1px solid green;
width:100%;
-webkit-flex: 1;
height:50px;
}
#media (max-width: 767px) {
.flexbox {
-webkit-flex-flow: column;
}
.first,.second{
width:100%;
}
}