CSS to remove header from quiz only

CSS to remove header from quiz only

by Ben Smith -
Number of replies: 14

Initially posted this in the Quiz forum 2 days ago, but it's crickets over there.

Using Moodle 2.6+, Essential Theme. I would like to remove the header title bar so that my quiz has more real estate and fits on one screen (when using widescreen monitor) without having to scroll to see the "Next" button.  I have entered the following into my theme's Custom CSS field to no effect.  

.quiz-2 #page-header {
display: none;
}

Thoughts?

Ben

Average of ratings: -
In reply to Ben Smith

Re: CSS to remove header from quiz only

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

Hi Ben,

I tried to find the header you want to remove as I thought overriding 'mod_quiz_renderer' might work but cannot find it.  Please would you be so kind as to post a screen shot of the exact element you want to remove.

Cheers,

Gareth

In reply to Gareth J Barnard

Re: CSS to remove header from quiz only

by Ben Smith -

Thanks for helping.  Second pic is screenshot of quiz, 1st is how I want the quiz to look.

 

Ben

In reply to Ben Smith

Re: CSS to remove header from quiz only

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

Oh, I see.  Altering the quiz will not work.  Need to find the layout for that page and create a new layout file, adapt it to remove the logo area and change 'config.php'.  Needs finding.

In reply to Gareth J Barnard

Re: CSS to remove header from quiz only

by Ben Smith -

what would the layout file be called?  Here are my layout php files.

columns1.php
columns2.php
columns3.php
embedded.php
frontpage.php
maintenance.php
secure.php

In reply to Ben Smith

Re: CSS to remove header from quiz only

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

Its a matter of turning on page information (Site administration -> debugging).  Going to the quiz, finding at the bottom the layout name, going to the theme's 'config.php' file, finding what layout file it is.  Then can copy, adapt and use.

In reply to Gareth J Barnard

Re: CSS to remove header from quiz only

by Ben Smith -

I don't mean to seem dense, I'm new to CSS, and as green as can be with PHP.  Here is my footer with debugging turned on.  I can't find any clear reference to a layout file or style.

 

 

 

 

In reply to Ben Smith

Re: CSS to remove header from quiz only

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Ben,

This is going nowhere... you are not dense...far from it...it is Essential that is missing some PHP in the footer, so you wont see the page info.

What you need to do is add this CSS to the Essential > General settings: Custom CSS box.

If you give me a moment or ten thousand! LOL to create a quiz and then I will be better equipped to get the correct CSS

But basically all you need to remove is the a.logo but I still need the page reference which goes something like...

.page-mod-quiz

so the finished class would be something like...

.path-mod-quiz a.logo { display: none;}

Try that and if it works, that's OK, but in the mean time I'll create a quiz on my new Moodle site which I am still building just to test this idea. smile

Don't forget Theme Designer Mode

Cheers

Mary

In reply to Ben Smith

Re: CSS to remove header from quiz only

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

Dear Ben,

Sorry about the shortness of my responses.  I had not realised the Essential theme did not print the information.  If Mary's very viable solution does not work for you then I'm sure we can all work out the new layout php file for you.

Kind regards,

Gareth

In reply to Gareth J Barnard

Re: CSS to remove header from quiz only

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

No need for new layout Gareth...just not worth it.

This was the one I was after Ben...

#page-mod-quiz-attempt a.logo {display: none;}

Works on the attempt page only.

To find the actual CSS ID for the page just look at the URL in the browser.

For example what I see now in the my browser's address bar as I am writing this is...

/mod/forum/post.php?reply=1065811#mformforum

so likewise in your quiz pages which ever page you want to disable the logo is find the first three sections like the ones I have  highlighted above and put them together like so...

#page-mod-forum-post

You can also find most of the these 'body' tags in the page's source code.

Just a right click and select 'View page source' which when viewed looks like this...

<body id="page-mod-forum-post" class="format-topics 
path-mod path-mod-forum gecko dir-ltr lang-en
yui-skin-sam yui3-skin-sam moodle-org pagelayout-incourse
course-5 context-115 cmid-46 category-1 content-only
">

Hope this helps on your code/css learning journey on your travels through Moodle?

Cheers

Mary smile

Average of ratings: Useful (2)
In reply to Mary Evans

Re: CSS to remove header from quiz only

by Ben Smith -

Mary, great tutorial here.  Thanks for the start.  I have added your code and the logo does go away.  I guess the next steps would be to find the other elements in the header and force them to not display for the attempt page.

How did you find a.logo?  I was able to perform a recursive grep on all my files in the essential theme and it looks like this logo is referenced in the following locations:

theme/essential/style/essential.css

theme/essential/style/settings.css

So, I took a look a the references in the header area and adjacent to a.logo in the essential.css file, attempted to hide elements with the following code:

#page-mod-quiz-attempt h2.main {display: none;}

#page-mod-quiz-attempt page-header {display: none;}

#page-mod-quiz-attempt userpicture {display: none;}

No effect, unfortunately.  I guess if I can get your thought process for a.logo then perhaps I can move forward.  I'd like the entire header band to disappear, for my quiz to look like this:

In reply to Ben Smith

Re: CSS to remove header from quiz only

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

I forgot to answer you question about the logo. I know where it is and how it is added and also the css and where it resides in the Clean theme, as I was the person who added it into the theme in the first place. I've worked on the Clean theme quite a bit, so has Gareth, he is still slogging away at it with more fixes, which I expect Julian will need to take into account after the new set of fixes are integrated into Moodle.

Just so you know...you will find all the element that reside in the header in Essential/layout/includes/header.php

If you look you will see the the <header id="page-header"> </header> tag holds all thos element you donlt want so hiding it with display: none is the best solutions.

Hope it works?

Good night

Mary

Average of ratings: Useful (1)
In reply to Mary Evans

Re: CSS to remove header from quiz only

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi,

You could try just losing the page-header with this...

#page-mod-quiz-attempt #page-header {display: none;}

Try that and let me know how you get on.

Cheers

Mary

Average of ratings: Useful (1)