Design comparison
Solution retrospective
Q1. How can I increase heading tags by one if I am looking for a specific font-size
Q2. Can we use semantic html tags like <section>, <article> when trying to style elements. Or only when they contain tags
Thanks for checking my solution! Have a great day ✨
Community feedback
- @abraundPosted over 1 year ago
Question 1) In your css I note you have set the color & font-weight for all of your header tags. There is nothing stopping your selecting those elements again. i.e. you can additionally have:
h1 { font-size: 20px; } h4 { font-size: 18x; }
Multiple selections of the same element (or class, or id) will only cause a problem if they aim to set the same css property (in which case specificity and order declaration will decide which value wins).
Question 2) Yes you can select by section. In your example you are selecting by an #id selector, which has the highest specificity. So it's hard to affect any change in your exact solution by going
section {color: red;}
for example. Something likesection {margin: 400px;}
will cause a scroll-box.Although you could select by
<section>
, it is better to select by class (sometimes id) and not by elements. Consider a larger site (which this page will be part of), general elements will be re-used heavily. On different pages<main>
,<section>
s, etc., will have different styling requirements. Thus it's better to have<section class="payment-plan">
. This also helps your CSS readability, if you select by the CSS class.payment-plan
then it's easy to imagine what it's influencing in the HTML. If in the CSS you select bysection
, well that's hardly descriptive, it could be anything.1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord