Answer the question
In order to leave comments, you need to log in
How can I force all page elements to inherit the font size from the body and not from the immediate parent in em units?
I'm doing a responsive layout and would like to transfer all fonts, margins, padding values to em units. But when setting the font size on the parent, the element automatically multiplies it by the number of ems, even though I want the BODY size (16px(default for all) * 62.5% = 10 | 1.6em = 16px -- in the entire document). How to cancel inheritance, or somehow get around it? Here is the part of the code where the SPAN element multiplies the font-size from .LOGO by 2, which gives 80px. I'm counting on 20:
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
main, menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
box-sizing: border-box;
// includes margins and paddings
// in heigth and width of every element on the page
// 16px(default for all) * 62.5% = 10 | 1.6em = 16px
font: 62.5% $regular;
font: inherit;
border: 0;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, main, menu, nav, section {
display: block;
}
ol, ul {
list-style: none;
}
a {
text-decoration: none;
}
blockquote, q {
quotes: none;
&:before, &:after {
content: '';
content: none;
}
}
table {
border-collapse: collapse;
border-spacing: 0;
}
header, section, footer {
font-size: 1.6em;
padding: 2em;
margin: 0 auto;
}
/* ========================================================
|| Begining
======================================================== */
header .row {
background-color: #76c7c0;
height: 80px;
.logo {
font: 2.5em $regular;
span {
font: 2em $extrabold;
}
color: #fff;
}
}
Answer the question
In order to leave comments, you need to log in
How to undo inheritance
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question