chameleon theme button

chameleon theme button

by henri pelissier -
Number of replies: 13

Hello,

There is a thing bothering me in the (excellent) customizable Chameleon theme: the text on the input buttons is left aligned when shown in iexplorer:

login.jpg search.jpg

In Firefox the alignment seems somewhat better:

loginfirefox.jpg

The devil is in the detail, and I have been trying to find in the css files how to center-align the button texts, but without success. Could anyonbe help me solve this little nagging thing? Thanks!

H. Pelissier

 

 

Average of ratings: -
In reply to henri pelissier

Re: chameleon theme button

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Henri,
Please could you post some screen shots to illustrate your problem?
Thanks,
Joseph
In reply to Joseph Rézeau

Re: chameleon theme button

by henri pelissier -

Well, as a matter of fact the jpegs I incorporated in my first posting show the problem: the words "Login" and "Search" appear to be aligned to the left of their buttons, instead of in the center.

H.P.

In reply to henri pelissier

Re: chameleon theme button

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
>the jpegs I incorporated in my first posting
Can't see those jpegs...
In reply to henri pelissier

Re: chameleon theme button

by Zoe Bogner -
Funny, those jpegs don't show up here for me either but they did in the email.

Anyways, that's very weird behaviour!

Try adding the following to your style sheet:

input {
text-align:center !important;
}

I think there must be something odd in your styles thats breaking the default behaviour of the button (Firefox knows better and displays it the way you expect). CSS attributes override each other as the browser reads the sheet from top to bottom. Adding !important makes that value override anything else that might come along, even in other stylesheets if you're using themes that have them.

Goodluck!
In reply to Zoe Bogner

Re: chameleon theme button

by henri pelissier -

Thanks for the response! I have tried to add your suggestion to various "input" elements in the different stylesheets (chameleon and standard) but without success. Oddly enough the text appears neatly in the center of the button in Firefox, Safari and Netscape browsers. Perhaps sth. to do with IE7?!? Hopefully a chameleon theme creator/user  knows the answer to  this anomaly...

http://elcole.freehostia.com/leftbuttons.html

H.P.

 

In reply to henri pelissier

Re: chameleon theme button

by Zoe Bogner -
Could you attach or post the link to your Chameleon stylesheets?

I was able to replicate your problem with input{ text-align:left; }, but that doesn't explain why you're only seeing the issue in IE. Taking a peek at your stylesheets should reveal the problem pretty quick. Could be something as simple as a missing ;
In reply to Zoe Bogner

Re: chameleon theme button

by henri pelissier -

Sure. I attach my user_styles.css of the chameleon theme. Besides this there are of course also the styles_layout.css (which definitely plays a role) and styles_ie7.css sheets of the standard theme. Thanks for the bother,

H. Pelissier

Here is the front page:

http://elcole.freehostia.com/ole/

In reply to henri pelissier

Re: chameleon theme button

by Mauno Korpelainen -

The text in login button is not centered in firefox either - margin and padding are just smaller.

I should still test this but after a quick look it looks like

div.sideblock div.content * {
  text-align: left;
}

is causing the problem.

Of course you could add all kinds of tags to styles_ie7.css and styles_ie6.css (or to the end of user_styles.css)  like

.block_login .loginform div.c1.btn {
  text-align:center;
}

but try first to take that * tag away from user_styles.css...

There is also one small mistake in div#azul tag but I guess you don't need it anywhere.

In reply to Mauno Korpelainen

Re: chameleon theme button

by henri pelissier -

And what a quick look it is: right on target! Deleting that asterisk (probably some debris from temporarily deactivating that piece of code with /*) puts the button tags right in the center again. Funny how one can overlook such a thing while scanning all those css tags.

Thank you very much (and to the other helpful contributions to my question - they all stimulate and sharpen the mind)!

H. Pelissier

 

In reply to henri pelissier

Re: chameleon theme button

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi again Henri,

I'm totally baffled by the "chronology" of the messages exchanged in this thread:

  1. henri pelissier - Saturday, 2 February 2008, 11:42 AM
  2. Joseph Rézeau - Saturday, 2 February 2008, 12:15 PM
  3. henri pelissier - Saturday, 2 February 2008, 08:47 PM
  4. Joseph Rézeau - Saturday, 2 February 2008, 11:08 PM
  5. Zoe Bogner - Sunday, 3 February 2008, 12:03 AM
  6. henri pelissier - Sunday, 3 February 2008, 01:33 AM

It looks like I posted my second message before my first one.

And now I can see the screen shot in your first message, which I could not see when I posted my previous messages...

It would be easier to help you if you could post side by side what things look like in MSIE and in FireFox, and if you could provide the URL of your site online so we can see exactly what things look like "in vivo". Which version of Moodle are you using?

Anyway, using Windows XP, moodle 1.8.4 with the Chameleon theme I have exactly the same display of correctly centered button text in both FireFox 2 and MSIE 7 (see attached). Your problem may come from either using a different configuration from mine of from having modified things in Chameleon. Have you tried with a completely "fresh" Chameleon theme?

All the best,

Joseph


Attachment image00.jpg
In reply to henri pelissier

Re: chameleon theme button

by Urs Hunkler -
Picture of Core developers
div.sideblock div.content * {
  text-align: left;
}

The * has not been forgotten but is a usual CSS way to apply styles to all elements within a range - in this case to replace all Moodle centred text with left-aligned text in the sideblocks. This way you don't need to add "text-align: left" to several CSS definitions but only use one for al.

When you remove the asterix several texts in the sideblocks may be centred again.

I have checked the browser rendering case. The main issue was that the button had the same wide width as the input fields attached. Now one noticed that Firefox renders the buttons with some padding and IE doesn't. Therefor it looked strange.

I had a long and hard struggle to convince my enemy IE6. The struggle took some hours and this time I won using some hacks to force it to play nice with the buttons.

After creating the tracker issue MDL-13329 I updated the CSS to optimise padding and centring of the button text for IE and now the buttons look similar in the different browsers for 1.8.4, 1.9 and 2.0.

In reply to Urs Hunkler

Re: chameleon theme button

by henri pelissier -
I have integrated the updated user_styles.css and styles_ie7.css sheets (Moodle Tracker MDL-13329) and the button labels are indeed nicely centered (I use IE7). The only minor beauty spot is that the username and password on the "returing to this website" page are also centered when you fill them in, but that is really a minor matter. Thanks for the useful feedback! HP. 
In reply to Urs Hunkler

Re: chameleon theme button

by Mauno Korpelainen -

Urs,

* is often useful but it also "cuts both ways".

Here in chameleon user_styles.css

div.sideblock div.content * {
  text-align: left;
}

replaces one text-alignment from standard theme styles_layout.css:

.sideblock .content div.info {
  text-align:center;
}

but at the same time this * drops all text-alignments from all elements inside all sideblock content css tags defined before (for example all buttons) and changes text-alignment to left. wink