I have a basic HTML page and three CSS files on each. The first CSS file (core.css) is for a very generic set of rules common to all pages. The second file (additional.css) contains rules specific to items on a page (homepage, blog page and so on). The third CSS file (mobile.css) contains all media queries for mobile display. I'm also using Bootstrap.
When the files are loaded in this order:-
- core.css
- mobile.css
- additional.css
The following media query contained in mobile.css does not get picked up by the browser.
When the files are loaded in this order:- - core.css - additional.css - mobile.css
the following media query contained in mobile.css works fine.
additional.css CSS Query
.blog .blog-item.right h4, .blog .blog-item.right .item-date, .blog .blog-item.right p {
text-align: right;
}
mobile.css CSS Query
@media (min-width:768px) and (max-width:992px) {
.blog .blog-item h4, .blog .blog-item .item-date, .blog .blog-item p, .blog .blog-item.right h4, .blog .blog-item.right .item-date, .blog .blog-item.right p {
text-align: center;
}
}
Is there any reason why the top style rule has to be loaded first before the @media query is run after? What takes precedence, as I assumed that if the screen width is between 768px and 992px, that this rule would be run, over the original rule?
I'm a reasonable newbie to CSS, I'm a .NET guy, so apologies for what might be a very basic question.
Thanks