align buttons in mobile web app

D

dorayme

<[email protected]
geoweb said:
Hi! I realized a simple google maps web app for webkit (use chrome or
safari to see it: http://www.mastercomunicazionestorica.it/geo/mapbuttons.html
) where I have built three controls that I put in the footer: my
problem now is how to exactly vertically align the three controls in
the footer's bar, is there anyone who can help me?

It's a mess on my Mac Safari 5, the map obscuring almost all text
above and below it. You are running into the common dangers of
absolute positioning. Abs pos takes things out of the normal flow
and needs careful handling.

I won't go into your nightmare CSS on the your map div but
simplest advice: don't absolute position or study the issues and
give better coordinates to leave more room at the top and bottom.
(btw, the dangers of using pixels for this is that users that
have a bigger text size than you are expecting will likely get
their text hidden).

About your footer, you need to note that not everyone will be
using flyspeck fonts (small) or wide browsers and that your
footer will not fit on one line. It is highly unlikely you need
so many divs and spans in it; it looks like over-coding.

If you want three buttons or anything in a row, lined up, there
are many ways to do this. You can put them in a three cell one
row table and use the default vertical-align or choose another.
Works well.

You can instead make sure they are same size and float all (but
remember, again, they will wrap if unable to fit on a line. You
can stop this latter by a min-width for the footer container but
that is not always the best for your users who might prefer not
to scroll horizontally).

You can simply put the items without too much fuss as display:
inline and they will then line up.

Because your efforts so far results in such a confused look,
please say better what it is you want.

Why *have* you got so many spans?
 
G

geow

<[email protected]



It's a mess on my Mac Safari 5, the map obscuring almost all text
above and below it. You are running into the common dangers of
absolute positioning. Abs pos takes things out of the normal flow
and needs careful handling.

I won't go into your nightmare CSS on the your map div but
simplest advice: don't absolute position or study the issues and
give better coordinates to leave more room at the top and bottom.
(btw, the dangers of using pixels for this is that users that
have a bigger text size than you are expecting will likely get
their text hidden).

About your footer, you need to note that not everyone will be
using flyspeck fonts (small) or wide browsers and that your
footer will not fit on one line. It is highly unlikely you need
so many divs and spans in it; it looks like over-coding.

If you want three buttons or anything in a row, lined up, there
are many ways to do this. You can put them in a three cell one
row table and use the default vertical-align or choose another.
Works well.

You can instead make sure they are same size and float all (but
remember, again, they will wrap if unable to fit on a line. You
can stop this latter by a min-width for the footer container but
that is not always the best for your users who might prefer not
to scroll horizontally).

You can simply put the items without too much fuss as display:
inline and they will then line up.

Because your efforts so far results in such a confused look,
please say better what it is you want.

Why *have* you got so many spans?

Hi dorayme, thanks for commenting, I am sorry but the css of the web
page I posted was an incomplete draft, that's the reason the page
appeared so horrible to see. Anyway I took advantage of your
suggestion to use a table to vertically align the buttons and the
title, that was I was looking for. Now it works on desktop browser
and on iOS/Android browsers, here you can see:
http://www.mastercomunicazionestorica.it/geo/mapbuttons.html
Thanks a lot,
G
 
D

dorayme

<[email protected]
,
....
If you want three buttons or anything in a row, lined up, there
are many ways to do this. You can put them in a three cell one
row table and use the default vertical-align or choose another.
Works well.
....

Why *have* you got so many spans?
....

Hi dorayme, thanks for commenting, I am sorry but the css of the web
page I posted was an incomplete draft, that's the reason the page
appeared so horrible to see. Anyway I took advantage of your
suggestion to use a table to vertically align the buttons and the
title, that was I was looking for. Now it works on desktop browser
and on iOS/Android browsers, here you can see:
http://www.mastercomunicazionestorica.it/geo/mapbuttons.html
Thanks a lot,[/QUOTE]
....

Well done. OK, now I see what you are wanting more exactly, here
are two other ways to line up your footer items, the first being
semantically better than the second. Note how most of the spans
do real work in one of the ways while in the other they are not
needed at all:

ul {list-style-type: none; margin: 0; padding: 0;}
li {float: left;}
..aiuto {float: right;}
..imposta_home {padding-right: 1em;}

with

<ul>
<li class="imposta_home">Imposta Home</li>
<li class="reset">Reset</li>
<li class="aiuto">Aiuto</li>
</ul>

and

..aiuto {float: right;}
..imposta_home {padding-right: 1em;}

with

<div class="footer">
<span class="imposta_home">Imposta Home</span>
<span class="reset">Reset</span>
<span class="aiuto">Aiuto</span>
</div>
 
G

geow

<[email protected]





...

Well done. OK, now I see what you are wanting more exactly, here
are two other ways to line up your footer items, the first being
semantically better than the second. Note how most of the spans
do real work in one of the ways while in the other they are not
needed at all:

ul {list-style-type: none; margin: 0; padding: 0;}
li {float: left;}
.aiuto {float: right;}
.imposta_home {padding-right: 1em;}

with

<ul>
<li class="imposta_home">Imposta Home</li>
<li class="reset">Reset</li>
<li class="aiuto">Aiuto</li>
</ul>

and

.aiuto {float: right;}
.imposta_home {padding-right: 1em;}

with

<div class="footer">
<span class="imposta_home">Imposta Home</span>
<span class="reset">Reset</span>
<span class="aiuto">Aiuto</span>
</div>

Hi dorayme, I'm gonna try these ways too, thanks for helping!
G
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,566
Members
47,202
Latest member
misc.

Latest Threads

Top