⊗mkPmSlTCS 59 of 250 menu

Tag with a given class in CSS

Let's say we have two types of tags with the same classes. For example, let's say both headings h2 and paragraphs have the same class:

<h2 class="eee">Title</h2> <p class="eee"> text </p> <h2 class="eee">Title</h2> <p class="eee"> text </p>

We can, for example, color all elements with this class red:

.eee { color: red; }

You can, however, target a specific tag with a class. For example, you can select all h2 with class eee and separately select all p with that class.

To do this, you need to write the tag name in the selector, and then the class name together. Let's, for example, color h2 with our class red, and paragraphs with this class - green:

h2.eee { color: red; } p.eee { color: green; }

The following code is given:

<h2 class="header">text</h2> <h2 class="header">text</h2> <h3 class="header">text</h3> <h3 class="header">text</h3> .header { color: red; }

Make all h2 with the class header sized 40px, and all h3 with that class sized 30px.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline