font-size discrepancy using rem

Hey guys I am doing a project and I am new to front-end. Doing so, I found something which I cant understand. Could you guys help me with that. My browser: 1rem = 16px If i set font-size on using join__cards *....i get expected font-size. But if i set that on its grand-parent div...even though font-size is inhereted (You can see this in the screenshot) font-size is unexpected. I dont understand why this is happening. Any help would be much appretiated. Thank you in advance.
No description
No description
No description
No description
7 Replies
Mannix
Mannix•7mo ago
heading elements have their own default font-sizes 😉
iDropPanties
iDropPanties•7mo ago
but when i put font-size using all selector..font-size says 32px in computed only when i put font-size in its grand-parent....fs says 37.something
Mannix
Mannix•7mo ago
because h3 has default font-size of font-size: 1.17em; so it's 32px * 1.17 which is 37.44
iDropPanties
iDropPanties•7mo ago
whoa...rem not only depends on root elem...it also depends on each elem type :(. Thank you so much man...i didnt even know what to search for on google. Thanks for that help. Also if you could...could you tell me the best practice to apply font-size in this case?,,,i just have to put 2rem on each of my card? 😦
Mannix
Mannix•7mo ago
if you want your h3 to have 2rem then use that selector to overwrite the default value rem looks at the root em look at the closest declared font-size
iDropPanties
iDropPanties•7mo ago
Thank you so much for the help man. Really saved me a shit ton of time
Mannix
Mannix•7mo ago
thumbup
Want results from more Discord servers?
Add your server
More Posts
Unable to change SVG icons color in reactI have downloaded svg files and added fill = "currentColor" to each individual . THen i created a fiSECURING CSS CODEHow to secure and protect the css code from "source code"? Like when you click the stylesheets fileHow do I import swiper.js package from node_modules into my main js.file?Hey guys, So I downloaded the swiper.js packackge via npm and did exactly what the doc says but it Is there a website or a repository in which we can see when CSS features were added?Sometimes I'll be looking up a feature on CanIUse or developer.mozilla.org to check its compatibilitDate Input field for birthday, 'masking' the user input, incorporating 'show' buttonI'm trying to create a birthday date input field inside of a React-bootstrap 'Form'. What I want iHow to horizontally center an element with translated content outside of it's widthI have a heading h3: ```html <h3>This is the width <span>extend</span></h3> ``` ```css h3 { widthIssue with Vite projectHello everyone, I'm having an issue with the Vite project. The issue is when I run the command npm rHow can I make the top of this overlay transparent?Hey guys I got this code and you can see it looks like like a "box"but I'm trying to make the top moText in Responsive Background Image Overflow```css .background-image-anime { width: 100%; background-size: 100% auto; background-image: urWhat tag should be used in the shown section?What tag should I use in the part where there is a photo, which is the best approach?