HighDots Forums  

CSS positioning cross browser inconsistency...

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss CSS positioning cross browser inconsistency... in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
celoftos@gmail.com
 
Posts: n/a

Default CSS positioning cross browser inconsistency... - 02-07-2009 , 01:45 PM






I have a simple page with some buttons arranged using some CSS.
Everything looks OK in IE & FireFox but in Chrome & Safari (Webkit
based browsers) the positioning of one of a couple of the buttons is
different.

What I am trying to achieve - cross browser button layout - a single
line of buttons where two buttons (btnLastViewedSlide and
btnRestartAudio) are anchored to the left side of the page and one
(btnExit) anchored to the right side; two buttons centered in the
middle of the page (btnPrevious & btnNext) and one button centered in
the space between btnNext and btnExit on the right hand portion of the
page.

The layout as rendered by IE and Firefox is was I was trying to
achieve but when I view the page in Safari and Chrome the
btnReferenceMaterial is to the left of center versus the right + plus
the btnRestartAudio icon is wrapped to the next line. Any idea why
this is happening and what can I change to achieve my desired layout?
It seems to me that the CSS line "margin-left: 21.375%;" may be
causing webkit browsers a problem.

The page is valid W3C 1.0 HTML and W3C 1.0 CSS. Here is a sample page:
http://www.freewebtown.com/emailceloftis/ButtonBar.html.

Reply With Quote
  #2  
Old   
dorayme
 
Posts: n/a

Default Re: CSS positioning cross browser inconsistency... - 02-07-2009 , 05:29 PM






In article
<19e21a6f-23c0-4205-94b7-61a75ab61b99 (AT) v38g2000yqb (DOT) googlegroups.com>,
"celoftos (AT) gmail (DOT) com" <celoftis (AT) gmail (DOT) com> wrote:

Quote:
I have a simple page with some buttons arranged using some CSS.
Everything looks OK in IE & FireFox but in Chrome & Safari (Webkit
based browsers) the positioning of one of a couple of the buttons is
different.

What I am trying to achieve - cross browser button layout - a single
line of buttons where two buttons (btnLastViewedSlide and
btnRestartAudio) are anchored to the left side of the page and one
(btnExit) anchored to the right side; two buttons centered in the
middle of the page (btnPrevious & btnNext) and one button centered in
the space between btnNext and btnExit on the right hand portion of the
page.

The layout as rendered by IE and Firefox is was I was trying to
achieve but when I view the page in Safari and Chrome the
btnReferenceMaterial is to the left of center versus the right + plus
the btnRestartAudio icon is wrapped to the next line. Any idea why
this is happening and what can I change to achieve my desired layout?
It seems to me that the CSS line "margin-left: 21.375%;" may be
causing webkit browsers a problem.

The page is valid W3C 1.0 HTML and W3C 1.0 CSS. Here is a sample page:
http://www.freewebtown.com/emailceloftis/ButtonBar.html.
Not sure where you get the idea that it is "W3C 1.0 HTML and W3C 1.0
CSS"?

Consider getting rid of all your CSS and instead:

#btnRestartAudio {vertical-align: middle; float: left;}
#nav {width: 12em; margin: auto; text-align: center;}
#btnReferenceMaterial {margin-left: 10%;}
#btnLastViewedSlide, #btnRestartAudio {float: left;}
#btnExit {float: right;}
#btnReferenceMaterial {float: right; margin-right: 3em;}

and rearrange the html as in

<http://dorayme.netweaver.com.au/alt/align.html>

--
dorayme


Reply With Quote
  #3  
Old   
Ben C
 
Posts: n/a

Default Re: CSS positioning cross browser inconsistency... - 02-07-2009 , 05:30 PM



On 2009-02-07, celoftos (AT) gmail (DOT) com <celoftis (AT) gmail (DOT) com> wrote:
Quote:
I have a simple page with some buttons arranged using some CSS.
Everything looks OK in IE & FireFox but in Chrome & Safari (Webkit
based browsers) the positioning of one of a couple of the buttons is
different.

What I am trying to achieve - cross browser button layout - a single
line of buttons where two buttons (btnLastViewedSlide and
btnRestartAudio) are anchored to the left side of the page and one
(btnExit) anchored to the right side; two buttons centered in the
middle of the page (btnPrevious & btnNext) and one button centered in
the space between btnNext and btnExit on the right hand portion of the
page.

The layout as rendered by IE and Firefox is was I was trying to
achieve but when I view the page in Safari and Chrome the
btnReferenceMaterial is to the left of center versus the right + plus
the btnRestartAudio icon is wrapped to the next line. Any idea why
this is happening and what can I change to achieve my desired layout?
It seems to me that the CSS line "margin-left: 21.375%;" may be
causing webkit browsers a problem.
The problem is that you've left the left property as "auto" on that
element.

CSS 2.1 says that means it's supposed to go where it would have gone if
it had been normal-flow (i.e. not absolutely positioned), but that the
browser is free to guess at that position.

Safari is guessing 0. Firefox is guessing something else (and then your
left margin is getting added on to that). Set left to 0 on that element
and Firefox looks the same as Safari. It's a difficult guess to make
because if it hadn't been absolutely positioned it would have been
inline.

It's best to set at least one out of left and right and at least one out
of top and bottom on anything absolutely positioned so you aren't
relying on this rule that says browsers are allowed to guess.


Reply With Quote
  #4  
Old   
Ben C
 
Posts: n/a

Default Re: CSS positioning cross browser inconsistency... - 02-07-2009 , 06:03 PM



On 2009-02-07, dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote:
Quote:
In article
19e21a6f-23c0-4205-94b7-61a75ab61b99...oglegroups.com>,
"celoftos (AT) gmail (DOT) com" <celoftis (AT) gmail (DOT) com> wrote:

I have a simple page with some buttons arranged using some CSS.
Everything looks OK in IE & FireFox but in Chrome & Safari (Webkit
based browsers) the positioning of one of a couple of the buttons is
different.

What I am trying to achieve - cross browser button layout - a single
line of buttons where two buttons (btnLastViewedSlide and
btnRestartAudio) are anchored to the left side of the page and one
(btnExit) anchored to the right side; two buttons centered in the
middle of the page (btnPrevious & btnNext) and one button centered in
the space between btnNext and btnExit on the right hand portion of the
page.

The layout as rendered by IE and Firefox is was I was trying to
achieve but when I view the page in Safari and Chrome the
btnReferenceMaterial is to the left of center versus the right + plus
the btnRestartAudio icon is wrapped to the next line. Any idea why
this is happening and what can I change to achieve my desired layout?
It seems to me that the CSS line "margin-left: 21.375%;" may be
causing webkit browsers a problem.

The page is valid W3C 1.0 HTML and W3C 1.0 CSS. Here is a sample page:
http://www.freewebtown.com/emailceloftis/ButtonBar.html.

Not sure where you get the idea that it is "W3C 1.0 HTML and W3C 1.0
CSS"?

Consider getting rid of all your CSS and instead:

#btnRestartAudio {vertical-align: middle; float: left;}
#nav {width: 12em; margin: auto; text-align: center;}
#btnReferenceMaterial {margin-left: 10%;}
#btnLastViewedSlide, #btnRestartAudio {float: left;}
#btnExit {float: right;}
#btnReferenceMaterial {float: right; margin-right: 3em;}

and rearrange the html as in

http://dorayme.netweaver.com.au/alt/align.html
Good stuff. I almost suggested something like that but thought you might
come up with something.

He did say he wanted Reference Material centered between Next and Exit
though, which you can do something like this:

http://www.tidraso.co.uk/misc/alignProb.html

Involves moving things around in the HTML a bit.


Reply With Quote
  #5  
Old   
dorayme
 
Posts: n/a

Default Re: CSS positioning cross browser inconsistency... - 02-07-2009 , 07:46 PM



In article <slrngos4sn.382.spamspam (AT) bowser (DOT) marioworld>,
Ben C <spamspam (AT) spam (DOT) eggs> wrote:

Quote:
On 2009-02-07, dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote:
In article
19e21a6f-23c0-4205-94b7-61a75ab61b99...oglegroups.com>,
"celoftos (AT) gmail (DOT) com" <celoftis (AT) gmail (DOT) com> wrote:

I have a simple page with some buttons arranged using some CSS.
Everything looks OK in IE & FireFox but in Chrome & Safari (Webkit
....

The page is valid W3C 1.0 HTML and W3C 1.0 CSS. Here is a sample page:
http://www.freewebtown.com/emailceloftis/ButtonBar.html.

Not sure where you get the idea that it is "W3C 1.0 HTML and W3C 1.0
CSS"?

Consider getting rid of all your CSS and instead:
....
Quote:
http://dorayme.netweaver.com.au/alt/align.html

Good stuff. I almost suggested something like that but thought you might
come up with something.
Two can play at this game pal, see below <g>
Quote:
He did say he wanted Reference Material centered between Next and Exit
though, which you can do something like this:

http://www.tidraso.co.uk/misc/alignProb.html

Involves moving things around in the HTML a bit.
Yes, I cheated on this last bit. Nevertheless, I began and then thought,
bugger it, why should I do all the work, Ben will come up with something
on this. And you did, nicely. <g>

Looking at yours, I notice that the 'ref material' button steps down the
page when text enlargement is clicked on Safari (*less* noticeable on
FF).

I looked at mine again and noticed previous/next buttons doing the same
thing!

I have tweaked with a line-height of zero for the prev/next buttons
wrapper. I also took a stab at a different margin to make the reference
button appear a little more centred (because I am lazy and is what I
would do instead of fussing over the exact specification).

<http://dorayme.netweaver.com.au/alt/align.html>

--
dorayme


Reply With Quote
  #6  
Old   
Ben C
 
Posts: n/a

Default Re: CSS positioning cross browser inconsistency... - 02-08-2009 , 05:07 AM



On 2009-02-08, dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote:
Quote:
In article <slrngos4sn.382.spamspam (AT) bowser (DOT) marioworld>,
Ben C <spamspam (AT) spam (DOT) eggs> wrote:

On 2009-02-07, dorayme <doraymeRidThis (AT) optusnet (DOT) com.au> wrote:
In article
19e21a6f-23c0-4205-94b7-61a75ab61b99...oglegroups.com>,
"celoftos (AT) gmail (DOT) com" <celoftis (AT) gmail (DOT) com> wrote:

I have a simple page with some buttons arranged using some CSS.
Everything looks OK in IE & FireFox but in Chrome & Safari (Webkit
...

The page is valid W3C 1.0 HTML and W3C 1.0 CSS. Here is a sample page:
http://www.freewebtown.com/emailceloftis/ButtonBar.html.

Not sure where you get the idea that it is "W3C 1.0 HTML and W3C 1.0
CSS"?

Consider getting rid of all your CSS and instead:

...

http://dorayme.netweaver.com.au/alt/align.html

Good stuff. I almost suggested something like that but thought you might
come up with something.

Two can play at this game pal, see below <g

He did say he wanted Reference Material centered between Next and Exit
though, which you can do something like this:

http://www.tidraso.co.uk/misc/alignProb.html

Involves moving things around in the HTML a bit.

Yes, I cheated on this last bit. Nevertheless, I began and then thought,
bugger it, why should I do all the work, Ben will come up with something
on this. And you did, nicely. <g

Looking at yours, I notice that the 'ref material' button steps down the
page when text enlargement is clicked on Safari (*less* noticeable on
FF).
Yes-- floats do that. But arguably it's better than scrolling off to the
right.

Quote:
I looked at mine again and noticed previous/next buttons doing the same
thing!

I have tweaked with a line-height of zero for the prev/next buttons
wrapper.
I suppose that's to get the text in them aligned with the text in the
floats? Noticeable at large font sizes.

You could also use #nav input { vertical-align: top }.

My version probably needs that for the Reference Material button since
that one isn't a float and all the others are.

Quote:
I also took a stab at a different margin to make the reference
button appear a little more centred (because I am lazy and is what I
would do instead of fussing over the exact specification).

http://dorayme.netweaver.com.au/alt/align.html

Reply With Quote
  #7  
Old   
celoftos@gmail.com
 
Posts: n/a

Default Re: CSS positioning cross browser inconsistency... - 02-12-2009 , 02:06 PM



On Feb 7, 7:46*pm, dorayme <doraymeRidT... (AT) optusnet (DOT) com.au> wrote:
Quote:
In article <slrngos4sn.382.spams... (AT) bowser (DOT) marioworld>,
*Ben C <spams... (AT) spam (DOT) eggs> wrote:





On 2009-02-07, dorayme <doraymeRidT... (AT) optusnet (DOT) com.au> wrote:
In article
19e21a6f-23c0-4205-94b7-61a75ab61... (AT) v38g2000yqb (DOT) googlegroups.com>,
*"celof... (AT) gmail (DOT) com" <celof... (AT) gmail (DOT) com> wrote:

I have a simple page with some buttons arranged using some CSS.
Everything looks OK in IE & FireFox but in Chrome & Safari (Webkit
...

The page is valid W3C 1.0 HTML and W3C 1.0 CSS. Here is a sample page:
http://www.freewebtown.com/emailceloftis/ButtonBar.html.

Not sure where you get the idea that it is "W3C 1.0 HTML and W3C 1.0
CSS"?

Consider getting rid of all your CSS and instead:

...



http://dorayme.netweaver.com.au/alt/align.html

Good stuff. I almost suggested something like that but thought you might
come up with something.

Two can play at this game pal, see below <g



He did say he wanted Reference Material centered between Next and Exit
though, which you can do something like this:

http://www.tidraso.co.uk/misc/alignProb.html

Involves moving things around in the HTML a bit.

Yes, I cheated on this last bit. Nevertheless, I began and then thought,
bugger it, why should I do all the work, Ben will come up with something
on this. And you did, nicely. <g

Looking at yours, I notice that the 'ref material' button steps down the
page when text enlargement is clicked on Safari (*less* noticeable on
FF).

I looked at mine again and noticed previous/next buttons doing the same
thing! *

I have tweaked with a line-height of zero for the prev/next buttons
wrapper. I also took a stab at a different margin to make the reference
button appear a little more centred (because I am lazy and is what I
would do instead of fussing over the exact specification).

http://dorayme.netweaver.com.au/alt/align.html

--
dorayme
Thanks for your suggestions!


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.