jeudi 13 juin 2019

Best practices for styling an element that can be positioned anywhere in a page

I wanted to know if there were a best practice for styling any element that in turn could be placed anywhere in a page and retain its margin. For example: An <h1> tag with a ruleset of margin-bottom: 2rem; and a <p> tag with a ruleset of margin-top: 2rem. Now these elements can be used anywhere within a webpage. But we the <h1> is placed before the <p> tag we will be encountered with a spacing of 4rem, now the behavior that I'd like to have is to maintain the space of one or the other. As a reminder this is a small example, a web page may contain all sorts of html elements as well as buttons and other components. To create a ruleset for each instance and combination is super time consuming and cumbersome, is there a better way?

Aucun commentaire:

Enregistrer un commentaire