Bootstrap: how to change width of container - css

I would like to change the width of container. I am using following code:
#media (min-width: 1200px) {
.container{
max-width: 620px;
}
}
#media(min-width:992px){
.container{
max-width: 620px;
}
}
#media(min-width:768px){
.container{
max-width: 620px;
}
When the size of the browser starts from 750px the width of .container inheritances the default width of bootstrap.
How can I solve this issue? There is another better way to reach my goal?

The best way is to change Less/Sass variable value and recompile styles or use customize

Related

Liquid layout explanation

Please see this example. When we resize the viewport, the font-size inside .main class grows, but inside .aside doesn't change anything. Could anyone please explain this for me? Thanks in advance!
Move .aside from media query:
#media (min-width: 700px){
.aside {
float: left;
width: 25%;
margin-left: 5%;
}
}
and put them like this:
.aside {
float: left;
width: 25%;
margin-left: 5%;
}
#media (min-width: 700px){
}
I think its because you haven't defined them anywhere else than in media query. Can you make JSFiddle out of this?
root cause:
Font size applyed based on container width (.main & .aside).
Fix:
You can fix this issue by using vw viewport width.
Viewport:
The % is relative to local width container, The vw length is relative to the full width of the browser window.
Default resolution:
body{
font-size:1vw;
}
Low resolution:
body{
font-size:4vw;
}

css element height minus height of a element with changing height

aye folks!
is it possible to have dynamic height calculation with css3? i couldn't find anything.. but maybe i'm just using the wrong terms for my search.
the problem: i have a site where i want to include an iframe with 100% height minus the height of a nav-element. unfortunately the nav-element isn't always the same height (44px on one device 36px on another.. and so on)
is there a way to calculate that? or do i need to fix the height of the nav-element to get this to work properly?
You may use display: flex property on the wrapper of the two elements.
html, body, #wrapper {
height: 100%;
}
#wrapper {
display: flex;
flex-direction: column;
}
#frame-fill {
flex-grow: 1;
}
<div id="wrapper">
<div>HEADER DYNAMIC</div>
<iframe id="frame-fill" src=''></iframe>
</div>
Be sure that you look for browser support for flex. Its a newer concept.
Sure!
I'm assuming the nav-element height is dependant on screen size, for which you can give different heights with media queries. So you only need to determine the size or width at which the element height changes:
/*put your conditions here*/
#media (min-height: 500px), (min-width: 580px) {
iframe{
height: calc(100% - 44px);
}
}
/*put your conditions here*/
#media (max-height: 1000px), (min-width: 580px) {
iframe{
height: calc(100% - 36px);
}
}
More info: http://www.w3schools.com/cssref/css3_pr_mediaquery.asp

Css Bug in Prestashop cause quick view miss

When I use default theme, I want to change container width to 100% on global.css in line around line 990:
Before:
#media (min-width: 1200px) {
.container {
max-width: 117022px; }
after:
#media (min-width: 1200px) {
.container {
max-width: 100%; }
Then the partis missing. How to fix it ? Thanks
Don't change styles for classes that are used on so many elements. If you want to have full width container use bootstraps container-fluid class instead of container for the element you want to be full width

Need to create wider container in Bootstrap - 1920px

I have .psd design for client site, graphic designer drew container width up to 1920px, and I need a help how to properly set up width of container to 1920px.
I know how to set up smaller
#media (min-width: 1200px)
.container {
width: 1170px;
}
Instead of forcing your containers to 1920px and overriding the default bootstrap grid sizes, you may want to look at .container-fluid, which is inside Bootstrap's packaged css.
Containers
Bootstrap requires a containing element to wrap site contents and house our grid system. You may choose one of two containers to use in your projects. Note that, due to padding and more, neither container is nestable.
Use .container for a responsive fixed width container.
<div class="container">
...
</div>
Use .container-fluid for a full width container, spanning the entire width of your viewport.
<div class="container-fluid">
...
</div>
Link: http://getbootstrap.com/css/#overview-container
You could utilize Bootstrap's container-fluid class to fill the entire width first, then you can restrict the width responsively... Here is an example in Sass:
.wide-container {
#extend .container-fluid; // which has max-width: auto; (full)
}
// on medium screens and beyond...
#include media-breakpoint-up(md) {
.wide-container {
max-width: 1470px; // limit the width here!
}
}
Just reuse the media query you have above, and simply decide when you want the container to change to that size (something greater than 1920px).
#media (min-width: YOUR VALUE HERE)
.container {
width: 1920px;
}
OR, upon reading your question again, you said, "up to 1920px", so a fluid container?
Then simply set:
.container {
max-width: 1920px;
width: 100%;
}
Your problem is not clear enough. but if you want to set up 1920px wide container, just override the default container width with "!important". like this,
.container { width: 1920px !important; }
Or if you wish to 1920px container only for larger displays, you can use media query like this,
#media (min-width: 2400px) {
.container {
width: 1920px;
}
}
this rule will apply only for displays that is at least 2400px wide.
You can apply your own CSS according to the screen size you want to show as the below example will work on a larger resolution size than 1599px.
#media (min-width: 1600px)
.container {
max-width: 1500px;
}
You could override BootStrap's default styling as the answers above describe, or you could create a new class such as:
.container.wide {
width: 1920px;
}
Then add the class to the container <div>'s such as:
<div class="container wide">
CONTENT
</div>
This ensures only the <div>'s you add the wide class to are effected, meaning you're still free to use <div class="container"> for normal BootStrap container behavior if required.
EDIT
As Vikas has said in his comment, the above style would apply also on mobile. In this case, just wrap in a media query as follows:
#media (min-width: 1950px) {
.container.wide { width: 1920px; }
}
This css will override bootstrap's container sizing. Adjust the max-width values as needed. Tested with bootstrap 4.6.1
/* Override bootstrap to make containers wider by 60px */
#media screen and (min-width: 576px) {
.container, .container-sm {
max-width: 600px;
}
}
#media screen and (min-width: 768px) {
.container, .container-md, .container-sm {
max-width: 780px;
}
}
#media screen and (min-width: 992px) {
.container, .container-lg, .container-md, .container-sm {
max-width: 1020px;
}
}
#media screen and (min-width: 1200px) {
.container, .container-lg, .container-md, .container-sm, .container-xl {
max-width: 1200px;
}
}
Based on your reactions you probably want
.container{
width: 1920px !important;
}
though I don't understand why :). On every smaller resolution it will scroll now.

Bootstrap max-width over 950px

How do I setup the with to say 1200px when my website runs on a regular PC or Mac?
Apparently Bootstrap has 12 columns in it's grid of 60px each plus gutters.
Is there a way to enlarge the column's basic width?
You can override the class .container in your css
.container {
width: 1200px;
}
You can try this :
Body {width:100%;}
#media (min-width: 950px) {
.container {
width: 1200px;
}
}
All this means is if your page width is small than 950px it will change the container to 1200px;
Do you want it responsive?
Answer came from here

Resources