sigmaxf
sigmaxf

Reputation: 8482

Font-size Initial CSS value for html heading tags

I want to reset the font-sze of H1 tags to the default.. according to W3 schools:

The initial keyword is used to set a CSS property to its default value.

Now when I apply it, the text appears smaller than the default (no CSS) value...

Example here:

http://jsbin.com/cifedofoci/edit?html,css,output

Upvotes: 1

Views: 1581

Answers (2)

Ozan Palanci
Ozan Palanci

Reputation: 159

I was trying to figure out this issue as well, and I found an explanation I want to share here;

Declaring display: initial is equivalent to display: inline. It won’t evaluate to display: block regardless of what type of element you apply it to. That’s because initial resets to the initial value for the property, not the element; inline is the default value for the display property.

So to say, the 'initial' value is the default value for the "Property", not a tag. An h1 element/tag, without any styling applied to it, has 32px(2em) font-size, and this value is derived from browser's settings when we talk about font-size property inside a h1 element, but font-size property by itself has 16px value overall throughout the page.

Upvotes: 0

Bbb
Bbb

Reputation: 126

The 'default' value is specific to each browser, it's not related to the tag or style. For most browsers the default value is 16px, while h1 sets the size to 32px.

Upvotes: 1

Related Questions