Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

difference between input/a with same style

0 views
Skip to first unread message

Aljosa Mohorovic

unread,
Nov 4, 2009, 6:23:08 PM11/4/09
to
i've applied the same style to A and INPUT but got different results.
when i apply this style:
--------------------
.mytest {
font-size:11px; font-family:arial; line-height:11px; text-
decoration:none;
background-color:#ccc; color:#000; border:0;
margin:0; padding:0; display:inline;
}
--------------------

to:
--------------------
<a href="#" class="mytest">test</a>
<input type="submit" class="mytest" value="test" />
--------------------

i get different results. in firebug INPUT occupies 24x15px space and A
18x13px.
any tips on what i'm missing?

Aljosa Mohorovic

Chris F.A. Johnson

unread,
Nov 4, 2009, 7:15:57 PM11/4/09
to

And on someone else's browser, it will be different again.

You have specified a font size that is too small for me to read, so
my browser will use a default (I think it's currently 18px). Since
you have set a line-height of 11 px, whatever I enter will be cut
off and unreadable.

> any tips on what i'm missing?

The fact that you *cannot* specify exactly what a page will look
like in someone else's browser (or even, apparently, in all of your
own browsers).

--
Chris F.A. Johnson <http://cfaj.freeshell.org>
===================================================================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)

dorayme

unread,
Nov 4, 2009, 7:31:04 PM11/4/09
to
In article <7lejptF...@mid.individual.net>,

OP might get closer to what is wanted, taking into account what Chris
says, by adding an explicit font-size: 1em; or thereabouts to the above
class's styles.

--
dorayme

Jim Moe

unread,
Nov 5, 2009, 12:22:50 AM11/5/09
to
On 11/04/09 04:23 pm, Aljosa Mohorovic wrote:
> <a href="#" class="mytest">test</a>
> <input type="submit" class="mytest" value="test" />
>
> i get different results. in firebug INPUT occupies 24x15px space and A
> 18x13px.
> any tips on what i'm missing?
>
Besides an URL to a test case?
As others have noted, that is a ridiculously small font size and line
height. You actually expect people to read it?
Out of curiosity, why are your using XHTML?

The submit element is a button with the extra decoration; the link
element is only text. The amount of extra decoration depends on the
browser, the browser's current theme (or "skin"), and the OS.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)

David Stone

unread,
Nov 5, 2009, 8:21:02 AM11/5/09
to
In article <doraymeRidThis-707...@news.albasani.net>,
dorayme <dorayme...@optusnet.com.au> wrote:

And setting the line-height to a ratio instead of a pixel value.
(What is this, meme-of-the-week time?)

Aljosa Mohorovic

unread,
Nov 5, 2009, 9:29:52 AM11/5/09
to
On Nov 5, 6:22 am, Jim Moe <jmm-list.AXSPA...@sohnen-moe.com> wrote:
> Besides an URL to a test case?

updated version at: http://67.23.27.235/buttons/

> As others have noted, that is a ridiculously small font size and line
> height. You actually expect people to read it?

this is example code, not something that i expect people to read.
font-size/line-height can be changed, my goal was to get the same
effect (or the best i can get) across browsers.

> Out of curiosity, why are your using XHTML?

no special reason.

> The submit element is a button with the extra decoration; the link
> element is only text. The amount of extra decoration depends on the
> browser, the browser's current theme (or "skin"), and the OS.

i understand that i can't get pixel-perfect style applied to a/input
tags but i'm sure i can get some advices how to improve my current
style.

Aljosa Mohorovic

Aljosa Mohorovic

unread,
Nov 5, 2009, 9:36:54 AM11/5/09
to
On Nov 5, 1:15 am, "Chris F.A. Johnson" <cfajohn...@gmail.com> wrote:
> > any tips on what i'm missing?
>
> The fact that you *cannot* specify exactly what a page will look
> like in someone else's browser (or even, apparently, in all of your
> own browsers).

would your advice be for me to find a different newsgroup to ask
stupid questions with users more tolerant to new users or is it just
an impolite way to point that my post could have been better prepared
with more details?

Aljosa Mohorovic

Christian Kirsch

unread,
Nov 5, 2009, 10:43:17 AM11/5/09
to
Aljosa Mohorovic schrieb:

None of the above. Other people are seeing your web page in a browser
that they have configured to *their* liking. They might prevent your
page from using its fonts, insisting on something like a 36 point Times.
To summarize: "you *cannot* specify exactly what a page will look like
in someone else's browser".

Jim Moe

unread,
Nov 5, 2009, 3:40:51 PM11/5/09
to
On 11/05/09 07:29 am, Aljosa Mohorovic wrote:
>
>> Out of curiosity, why are your using XHTML?
>
> no special reason.
>
The you should be specifying HTML Strict and validating your pages at
<http://validator.w3.org/>. Why? Read the almost daily explanations in
this newsgroup.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

>> The submit element is a button with the extra decoration; the link
>> element is only text. The amount of extra decoration depends on the
>> browser, the browser's current theme (or "skin"), and the OS.
>
> i understand that i can't get pixel-perfect style applied to a/input
> tags but i'm sure i can get some advices how to improve my current
> style.
>

Your examples show the differences between using a link elements and a
input element. It is not clear why you asked the question. It is possible,
with the extensive use of CSS, to adjust the margins and paddings of each
element until they look the same. On your screen. In your browser.
Basically, though, if you have a form to submit, use a submit button;
that is what its function. Using a link element for submit is senseless.

dorayme

unread,
Nov 5, 2009, 5:20:37 PM11/5/09
to
In article <no.email-B6F4B1...@news1.chem.utoronto.ca>,
David Stone <no.e...@domain.invalid> wrote:

> > OP might get closer to what is wanted, taking into account what Chris
> > says, by adding an explicit font-size: 1em; or thereabouts to the above
> > class's styles.
>
> And setting the line-height to a ratio instead of a pixel value.
> (What is this, meme-of-the-week time?)

Oops... yes, my fingers didn't know when to stop! I doubt it mattered
much in this case. Note, it is not wrong to use a unit, just a tad
dangerous in situations where, for example, the line height is set on a
container that has descendants with different font sizes.

(Sport is to go meme busting every now and then but I was not meaning to
on this occasion <g>)

--
dorayme

0 new messages