Prime
Prime

Reputation: 3625

What is the default px, pt for font-size :small?

What is the default px, pt for font-size:small ?

.navigation li a{
font-weight:400;
font-family: "Segoe UI",Segoe,Tahoma,Arial,Verdana,sans-serif;
text-decoration:none;
**font-size:small;**
}

Upvotes: 1

Views: 2744

Answers (2)

Khanh TO
Khanh TO

Reputation: 48972

It depends on the user agent.

From the book: Pro Css techniques

The keywords provide relative font sizes to one another based on a scaling factor of the user agent. This scaling factor is somewhat of a moving target, as different user agents may provide different scaling factors. Even the CSS specification changed its recommendation between versions 1 and 2. (CSS 1 specified a scaling factor of 1.5 going up and .66 going down, but changed to a more vague “between 1.0 and 1.2” in the CSS 2 specification.)

Because of this, the exact pixel sizes of rendered type vary from browser to browser when size is specified using absolute-size keywords. If we assume a default (medium) em square size of 16 pixels (like most desktop browsers give us out of the box), we end up with the following translations to pixel sizes for scaling factors of 1.5 and 1.2:

enter image description here

Upvotes: 4

Akshay
Akshay

Reputation: 14348

Jquery answer - px-13px pt-9.75

alert('px :-' +$('p').css('font-size'))
alert('pt :-' +parseInt($('p').css('font-size'))*3/4)
p{
    font-size:small;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<p>Text</p>

Upvotes: 2

Related Questions