media queries

media queries

by Alisa Natal -
Number of replies: 3

Every time I try to add a media query in CSS, it causes everything to display incorrectly. 

I am using the same queries as are used in the CSS (or at least as they come up in inspector), like:

@media (max-width: 1199px)
#region-main-settings-menu.has-blocks, #region-main.has-blocks {
    width: 100%;
}

But, when I save them in my custom CSS area, it doesn't work (in fact it seems to disable all CSS). 

Has anyone else had this issue? Am I missing something? 

FYI... does it weird anyone else out that the CSS applies to both the back-end and front-end? From a developer who has used a lot of CMSs, I find this to be incredibly bizarre. 


Average of ratings: -
In reply to Alisa Natal

Re: media queries

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Your media query css needs to be wrapped in brackets too

@media (max-width: 1199px) {
    #region-main-settings-menu.has-blocks, #region-main.has-blocks {
        width: 100%;
    }
}

Moodle doesn't have a 'backend' and 'frontend' as (for example) WordPress.

You are free to use a different theme for an individual user, such as the Administrator, or to construct a theme that looks different on certain pages, such as Settings.

However, other than the Site Admin role, roles in Moodle are applied at a context level, not at a site level - ie a user could be a teacher in one course, but a student in another, and even within that system, permissions can be tweaked so that an individual user (or role) can access settings and other 'backend' pages which the core default permissions may not normally give them. So constant switching between different interfaces would be disconcerting for many (IMO). Moodle is far more than a CMS, with far more complex activities, settings, roles and permissions, so has a different way of working to simpler systems.


'Incredibly bizarre'  No, just what you are used to - I find it (although getting used to) weird that in WP I have to go to a totally different interface to edit anything, where in Moodle (which is what I got used to at first), I can edit in place provided permissions allow. To me, that is the natural behaviour and what I would want to see in a system - but I don't go around calling WordPress 'bizarre' because it doesn't work the same way as Moodle.

Average of ratings: Useful (1)
In reply to Richard Oelmann

Re: Moodle in English: Re: media queries

by Alisa Natal -
Uhg rookie mistake! I don’t know how I missed that. Thank you!



Interesting, I never considered the complexity of it as far as users are involved. That makes sense. And yes it’s my first time in a system like this and I’m in a fast-paced learning curve as I develop this.
In reply to Alisa Natal

Re: Moodle in English: Re: media queries

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Alisa,

RE: "FYI... does it weird anyone else out that the CSS applies to both the back-end and front-end? From a developer who has used a lot of CMSs, I find this to be incredibly bizarre. " - that's not what I understand by the concept of a Front and Back end whereby the UI is the front end (view) and the back end the database / model / controller, in MVC (Model View Controller).  So with https://en.wikipedia.org/wiki/Front-end_web_development and https://en.wikipedia.org/wiki/Front_and_back_ends then CSS is always at the 'front end' and cannot be applied to the 'back end'.  So I think you might be confused with the different views presented to users depending on their role.  So in Wordpress there is the administration dashboard which is the UI to control things, however it still uses styles that are used for the site, such as font, heading and paragraph.  Therefore Moodle is no different to any other CMS in this respect.

Gareth

Average of ratings: Useful (1)