CSS max-width media query taking effect regardless of width - media-queries

I am trying to make the paragraph color in red with a max of 1440px, but at the end the paragraph is just colored in red with all the proportions more and less than 1440px. I inserted meta in HTML. What else could be the problem here?
#media screen and (max-width: 1440px) {
p.text {
color: red;
}
}

Related

I'm trying to create a responsive design that adjusts to different screen sizes using CSS media queries. Can someone help me figure out what's wrong

`#media screen and (max-width: 768px) {
.my-element {
font-size: 16px;
}
}
#media screen and (min-width: 768px) and (max-width: 1024px) {
.my-element {
font-size: 18px;
}
}
#media screen and (min-width: 1024px) {
.my-element {
font-size: 20px;
}
}`
I was expecting the font size of .my-element to adjust based on the screen size, but it doesn't seem to be working. What am I doing wrong?"
Make sure that the .my-element class is being applied to the correct element in your HTML. If it's not, the font size won't adjust as expected.
Check that there are no other styles elsewhere in your CSS that might be overriding the font size changes made by the media queries.
Try adding the !important declaration to the font-size property in each media query to ensure that it takes priority over other styles. However, it's generally not recommended to use !important unless it's necessary to do so.
Verify that your browser window size is within the range specified by one of the media queries. If it's not, the font size won't adjust until the screen size meets the criteria of one of the media queries.

Changes in Shopware5 less-file has no effect

I've installed Shopware
inherited from the responsive theme and
adjusting the colors (less-files).
This worked well with the header and a few other components like container.less but not offcanvas-menu.less.
In Detail:
finding the color to change:
For this I first made all colors of the entire shop unique. So I can easily tap the color value over the current shop via a pipette tool.
Then I find the color value in the source code and copy the corresponding less source code components into my new theme. Only then do I change the color.
copied inside themes/Frontend :
a) /Responsive/frontend/_public/src/less/_components/offcanvas-menu.less too
b) /MyNewTheme/frontend/_public/src/less/_components/offcanvas-menu.less
the following part :
.sidebar--navigation {
.border-radius();
background: #0492d6;
.navigation--entry {
&:last-child {
border-bottom: 0 none;
}
}
.navigation--link {
overflow: hidden;
text-overflow: ellipsis;
}
}
and changed background: #0492d6; to background: #003E7e; inside b)
Complete result: gist MyNewTheme offcanvas-menu.less
But if i reload and grap the color i got again #0492D6.
As doppelcheck i changed the color in a) to background: black; and its black.
As another doppelcheck i changed the color in themes/Frontend/MyNewTheme/frontend/_public/src/less/_components/container.less to background: red; And red is visible.
Please check if you also imported it.
Please enter in your themes\Frontend\MyNewTheme\frontend_public\src\less\all.less
#import "_components/offcanvas-menu";

Bootstrap 3 - remove breakpoint between md and lg

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.

Bootstrap nav justified odd responsive issue

The nav starts out great once you lower the bowser width the nav becomes stacked, this is great. Once you open the window back up the nav items are in two rows. Here's a pic.
This is how it starts out:
http://reggi.myshopify.com/pages/about#
FWIW, I found that forcing a redraw of the .nav-justified element in question helps WebKit understand. Obviously, how you chose to do this is up to you—I opted for the fadeIn(), 'cause when life hands you lemons...
$(window).bind('resize', function(){
var w = $(this).width(),
threshold = 768;
if(w < threshold){
$('.nav-justified').hide().fadeIn();
}
});
Both answers seem to be lacking. The JS solution causes a lot of flicker, and the CSS solution doesn't seem to keep the integrity of the designed tabs. Here's what I came up with.
If you're not using less with your bootstrap styles just replace #screen-sm with 768px
#media (min-width: #screen-sm) {
.nav-tabs.nav-justified > li {
display: block;
float: left;
width: 32.9999%
}
}
The problem is display: table-cell; instruction in the .nav-justified class.
Let's take a look at the bootstrap.css file, I believed that you are using Bootstrap version 3.0, at line 4109.
#media (min-width: 768px) {
.nav-tabs.nav-justified > li {
display: table-cell;
width: 1%;
}
You must change it to :
#media (min-width: 768px) {
.nav-tabs.nav-justified > li {
display: inline-block;
float: left;
margin-left: 100px;
}
}
This will solve your problem.
This is a known bug with Bootstrap.
This has been fixed in Chrome Since 2013, but is still an open bug in WebKit and occurs in Safari.
Safari exhibits a bug in which resizing your browser horizontally causes rendering errors in the justified nav that are cleared upon refreshing. This bug is also shown in the justified nav example.
— cvrebert
I recommend to not use .nav-justified or be ok with it not working properly in Safari.

Vertically align vertical text in SlickGrid header

I am changing the height of a SlickGrid header and rotating the text in the header with the following CSS:
.slick-column-name {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
transform-origin: 50% 50%;
}
.slick-header-columns, .slick-header-column {
height: 200px !important;
}
For a better understanding, please take a look at this:
http://jsfiddle.net/2Nvc3/1/
The rotated text in the header is centered and cut off. How can I change the alignment, so that it starts on the bottom (the text should be left-aligned before the -90° rotation)?
The width of one of the columns is different on purpose.
Link to jsFiddle I played around for a while. Basically the problem was that the origin of rotation was the middle of your text/header. Since "Else else SOmeshing Else" is significantly longer than the other column names, it sticks out on both sides. Either way - changing the origin of location to the beginning of the text solves this issue. Then to center um...horizontally(after the rotation) the text we put a margin-left of 40% - at leat that looks good in Chrome, not exactly sure why it's not 50%. To center the text um...vertically(after the rotation) we just add a text-indent of -235px, which is dictated by the height chosen here to fit the text, which is 250px.