Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is there a way to define input in css style?

I am really new to this CSS style, I learned you can define style like the following:

.header {
        color: black;
        font-family: "Calibri, sans-serif";
        font-size:18px;
    }
    .body {
        color: black;
        font-family: "Calibri, sans-serif";
        font-size:12px;
    }
    .footnote {
        color: black;
        font-family: "Calibri, sans-serif";
        font-size:10px;
    }

Then put it in the code:

<p class = "header"> THIS IS HEADER </p>
<p class = "body"> THIS IS BODY </p>
<p class = "footnote"> THIS IS Footnote </p>

My question is, since the header, body, footnote all share same font, the only change I need is change the font-size, is there a way I can do to just call the style one time and change the font size?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thanks

>Solution :

.header,.body,.footnote{
        color: black;
        font-family: "Calibri, sans-serif" ;
}
<p class = "header" style="font-size:18px;"> THIS IS HEADER </p>
<p class = "body" style="font-size:12px;"> THIS IS BODY </p>
<p class = "footnote" style="font-size:10px;"> THIS IS Footnote </p>

or you can create a common class and use it instead and pass inline css which is different for each element

.common-style{
        color: black;
        font-family: "Calibri, sans-serif";
}

<p class = "common-style" style="font-size:18px;"> THIS IS HEADER </p>
<p class = "common-style" style="font-size:12px;"> THIS IS BODY </p>
<p class = "common-style" style="font-size:10px;"> THIS IS Footnote </p>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading