media queries are unresponsive in current program, have even reused some from a previous page because its for an internal page that shares features, but now they dont work. what’s wrong with how they’re written? example below:
class:
.hero-text {
color: blue;
text-decoration: none;
font-family: papyrus;
font-size: 1.35rem;
}
what i need the query to do:
@media (max-width: 400px) {
.hero-text {
font-size: .5rem;
}
}
That’s a good question. I’ve made headbanging errors like that too many times to admit.
@ZTD try to tag !important into the font-size: .5rem and see if that ‘fixes’ it. It’s bad practice I know, but can help debug some. The code you have should work.
you got that right! but hey i think when we look back at those errors, thats a big step to getting better and then we KNOW what not to do. ill give that a go, and at the same time im completely reorganizing my CSS now from this, but i like it a lot more now.
One simple fix is to only use class,
so you won’t have to get your head around selector specificity and only the order from top to bottom becomes relevant.
You had it on a h4 selector before. Is still the same selector but with a .hero-text class now?
Do you have a global setting for the h4 somewhere that can possibly override the class?
I think the issue is on inheritance.
the h4 wasnt for the OP actually, it was a copy of another query that i had used on another page that functioned well. more like showing one i wrote that did work to compare to the OP. and ill look up how to do that second part right now.
ok i got the query to work, but now even though it just shrinks the text (as intended) the text is a link in a nav bar and when the query kicks in the clickable link goes dead. in 1.35rem size it works again if i expand the page out of mobile size. having a hell of a time finding anything online for such a strange issue. ill post a link below to the Pen, shrink to about 400px and nav bar goes dead. TYIA
I would suggest, to eventually try to clean it all up and minimize the media queries. I’m not sure what is ‘standard’ … but I generally only use 1 break-point at around 500px view width.
What has worked best for me is to give everything background colors and see what is going on.
RED is the main header, it is fixed at the top and always 100% view width (which you have)
Green holds the logo, and should always be left, Yellow hold links and should always be right.
If RED was a Flexbox with “space between” and since we only have to inner items, Green would be forced left & yellow right.
I think you already have it, from the second image, but Green should grow to 100% width & stack on top of Yellow. I think Yellow could stay Row too, just grown 100% width too.