user agent stylesheets

user agent stylesheets

by abhishek bhattacharjee -
Number of replies: 20

how do i disable the user agent stylesheets...its overriding my curent css .i need to change the textbox color on focus from yellow to some other color i have tried doing that using 

!important 

or creating a seperate class for the input type and providing the css for that nothing worked 

thank u in advance 

Attachment scr.png
Average of ratings: -
In reply to abhishek bhattacharjee

Re: user agent stylesheets

by Paul Lemarchand -

Hi,

You should keep in mind that everytime you use the !important tag, a baby penguin dies in Antarctica.

 Did you make the change at the bottom of your file located in theme style/custom.css ? Where is that box you want to modify, I could provide you a solution. Is it the one located on the top right of the screen ?

In reply to Paul Lemarchand

Re: user agent stylesheets

by abhishek bhattacharjee -

thanks for your concern paul

yes the above box i want modification i have tried changing color to #002f5e using !important with no use

have attached the screenshot below


Attachment src.png
In reply to abhishek bhattacharjee

Re: user agent stylesheets

by Paul Lemarchand -

I just tried, something like that works on my theme (just replace the color with yours) :

 nav .usermenu a.toggle-display:focus { background-image:-webkit-gradient(linear, 0 0, 0 100%,from(red),to(black)); } 


Please let me know if this works for you, if not which theme are you using ?

In reply to Paul Lemarchand

Re: user agent stylesheets

by abhishek bhattacharjee -

thanks for your reply again 

i tried that with fail nd i have customized the login page that is the username box the screenshot i have posted above

theme you asked i have created my own theme 

that text box is having default color yellow on focus for the login page if u go through i need to change that

thanks for your help anyways

In reply to abhishek bhattacharjee

Re: user agent stylesheets

by Paul Lemarchand -

I don't have anything yellow in my website, that's why I wasn't sure which one it is. You said textbox, are you talking about the place you put your username in the login page ?

In reply to Paul Lemarchand

Re: user agent stylesheets

by abhishek bhattacharjee -

yes exactly if you download moodle and install when it asks you for the login and the password the box which is in focus the background color is yellow 

In reply to abhishek bhattacharjee

Re: user agent stylesheets

by Paul Lemarchand -

.loginbox .loginform .form-input input:focus { background:#002f5e; }

In reply to Paul Lemarchand

Re: user agent stylesheets

by abhishek bhattacharjee -

still not working ...the user agent stylesheet css been taken 

thank you very much for your concern

In reply to abhishek bhattacharjee

Re: user agent stylesheets

by Paul Lemarchand -

Well, it works for me... You're putting it in theme/style/custom.css, at the bottom of it right ?

In reply to Paul Lemarchand

Re: user agent stylesheets

by abhishek bhattacharjee -

yeah i did put it in the buttom of the custom.css of the theme still fails..

In reply to abhishek bhattacharjee

Re: user agent stylesheets

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

If it is your own customised theme, then make sure you have theme designer mode enabled, or have purged caches, as you may not have built the automatic cache purge into the settings as many themes now use.

In reply to Richard Oelmann

Re: user agent stylesheets

by abhishek bhattacharjee -

hello richard

i have purged caches earlier it didnt worked and now i enabled theme designer mode still nothing changes

i am posting the screenshots of my html page and the css below i guess that will help you to have the clear picture

css is

 #loginbox .loginform .input-group .foo input:focus { background:#002f5e; }

thanks for helping

Attachment src.png
In reply to abhishek bhattacharjee

Re: user agent stylesheets

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

OK - first of all there is an error in your line of code - because .input-group and .foo are declared on the same element, there should not be a space between them in your css rule

#loginbox .loginform .input-group.foo input:focus { background:#002f5e; }

Secondly - and this may be intentional - I presume you are aware that your rule will only apply when that particular input has the web page focus and will retain its original colour the rest of the time? To change the colour at all times, remove the :focus.

As a hint for your theme, too, you should try to avoid the use of all those inline styles where practical. They make it much harder to style or restyle using css or settings in the future. They could all be added to your theme stylesheets.

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

Re: user agent stylesheets

by abhishek bhattacharjee -

thanks a lot richard thank you very much that really worked but i found its chrome what is the problem edge i checked that yellow is not coming for chrome it is still there so browser problem is there anything that can be done to remove that from chrome it comes when

u had checked with the checkbox remember me when u select that same name  yellow comes on the background for chrome only can that be changed

thanks again richard and paul for helping ....

Attachment login.png
In reply to abhishek bhattacharjee

Re: user agent stylesheets

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

As mentioned above, get rid of the :focus from your css rule and it should apply to that selector all the time, not just when it is focussed.

Also, given that this is a custom theme, you might want to look at some of the existing themes and what they do, as this doesn't happen for me with most themes (eg Clean/More/Flexibase) on Chrome, so there must already be a rule overriding that browser agent setting in most themes.

Take a look at them, use something like chrome developer tools to see what is being applied and make use of that.

In reply to Richard Oelmann

Re: user agent stylesheets

by abhishek bhattacharjee -

thanks a lot again i will check with the setting of the other themes 

got another problem i created a theme seeing the documentation moodledocs creating a theme

after doing that while creating a user i dont get to see the create user option at the bottom i can't crate user this is same when i want to create a course i don't get that create course at the bottom my standard.php is same as mentioned in moodle docs and even the config.php is the same.

what according to you the problem might be

Attachment theme.png
In reply to abhishek bhattacharjee

Re: user agent stylesheets

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

Well, without actually seeing your theme or knowing anything else about it, the thing that jumps out to me is that there must be some css hiding the button as the button itself is created within the main content code.

Which docs have you actually used to create your theme - the best and most current one would be

https://docs.moodle.org/dev/Clean_theme

The one that refers to standard.php is for Moodle2.0 and 2.1 You really do need to look at one of the more modern themes and one of the more upto date guides, including the one that is part of the readme file of Clean!

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

Re: user agent stylesheets

by abhishek bhattacharjee -

thanks for the reply richard 

i have not used clean_theme document

i have used the following

https://docs.moodle.org/dev/Creating_a_theme

i copied that whole standard.php and the css whats provided there i will search for it if any css is hiding it or not will let you know once i find it

In reply to abhishek bhattacharjee

Re: user agent stylesheets

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

Well, as I said, that is for an older version of Moodle - as it says in the very first line on the page

'This document describes how to create a theme for Moodle 2.0 and Moodle 2.1. ONLY'

So, if you are using that you really need to look at some of the newer documentation - or if you are using Moodle2.0-2.1 you need to upgrade as they are a long way out of support!

Average of ratings: Useful (1)