Current Bootstrap Version 3.3.7
Are all media queries for bootstrap-sass deprecated, I tried running one media query and kept getting errors below.
How can I use media queries in bootstrap-sass?
See Image Below
See Error Below
My style.scss file
#media (min-width: #screen-lg-min) {
.navbar{
height: $navbar-height * 2;
}
}
Variables in SASS are marked with a $ sign, not #. So the line should look like this:
#media (min-width: $screen-lg-min) {
.navbar{
height: $navbar-height * 2;
}
}
Related
Emmet autocomplete doesn't add semicolon after css rules inside media query.
div {
display: none;
}
#media (max-width: 991.98px) {
div {
display: none
}
}
Outside media query
Inside media query
This is a bug in the plug-in which is under investigation. Keep track of it here: https://github.com/emmetio/sublime-text-plugin/issues/173
UPDATE: This has now been fixed.
I am using ngx-extended-pdf-viewer(4.0.0-alpha.5) in Angular 8 and pdfs are showing up correctly except for when I am using single paged pdfs. For single paged pdfs, the preview is blank. Is there any solution?
My code is here
<ngx-extended-pdf-viewer [delayFirstView]="250" src="{{apiBaseURL}}unprotect/estimate-report/view/{{currentestimationid}}/{{estimationReportType}}" useBrowserLocale="true" height="80vh" [textLayer]="true"></ngx-extended-pdf-viewer>
[View image][1]
[1]: https://i.stack.imgur.com/foGsi.png
Issue resolved by adding the CSS rule
#media print {
#printContainer>div {
display: inline;
}
}
I've added the ng-deep and finally the preview appears:
#media print {
::ng-deep #printContainer > div {
display: inline;
}
}
I have the following code snippet in my SCSS to modify the CSS according to device size.
.cu-list-project li{
#media (min-width: #screen-md-min) {
width: 60%;
#include project-list;
}
}
But Sass gives the following error:
*error styles/sass/styles.scss (Line 108: Invalid CSS after "...ia (min-width: ": expected expression (e.g. 1px, bold), was
"#screen-md-min) {").
Apparently, "#screen-md-min" is not recognized by Sass. What should I do?
P.S: I know I can change #screen-md-min to 992px but this will not be a best practice. So, I'm looking for a real solution not a workaround. thanks.
Looking at the source code for the bootstrap-sass, you should use $screen-md-min e.g.
#media (min-width: $screen-md-min) and (max-width: $screen-md-max) {
#include responsive-visibility('.visible-md');
}
From line 89 on Github
I'm using Bootstrap 3 and trying to remove/exclude the breakpoint between medium and large devices. I have a existing website which is optimised to 970px which looks great. What I am trying to do is remove the md > lg breakpoint so that even on large widescreen desktops the maximum body width is 970px and still centred.
Anyone know if there is a quickfix solution to this?
Any advice would be much appreciated
Decbrad
If you're overriding the bootstrap breakpoint (and using containers properly), adding this below the bootstrap breakpoint media queries in the bootstrap CSS file should work for you.
If using LESS
#media (min-width: #screen-lg) {
.container {
width: 970px;
}
}
OR, you can simply override the bootstrap container in your own CSS (just make sure you load it after bootstrap.css)
#media (min-width: 970px) and (max-width: 2500px) {
.container {
width: 970px;
}
}
OR you can find the media query in the bootstrap.css file on around line 1240 and simply change it there
#media (min-width: 1200px) {
.container {
width: 1170px; /* change 1170 to 970 */
}
}
the less way is good but this one is more flexible and reliable:
#media (min-width: #screen-sm) { .container { width:#screen-md; } }
Because in bootstraps default values the width of #screen-md is 992px.
Now you will just have a breakpoint for small devices (smartphones) and any other bigger devices. they will all get the same layout
You can set a max width on the containers:
.container-fluid,
.container {
// Disable large-desktop breakpoint.
max-width: $container-md;
}
No need for media queries or anything.
The $container-md value is typically 970px, unless you changed the $grid-gutter-width. For LESS, replace the $ of variables with an #. For regular CSS, replace the variable with the hard coded pixel size.
I have the following less code:
#mobile: ~'screen and (max-width: 480px)';
Then I use it as follows:
#media #mobile {
// some code
}
It works fine but I would like to also use "not" like:
#media not #mobile {
// some code
}
But I get the error
ParseError: Unrecognised input
in the "not" part.
Is it possible to solve this?
Maybe you could do something like this:
Define the width of a mobile device:
#mobileWidth: 480px;
Then anything larger is a non-mobile device:
#notmobileWidth: #mobileWidth + 1px;
Create LESS variables for both mobile and notmobile:
#mobile: ~'screen and (max-width: #{mobileWidth})';
#notmobile: ~'screen and (min-width: #{notmobileWidth})';
And then use those in your media queries:
#media #mobile {
// some mobile code
}
#media #notmobile {
// some not-mobile code
}