⊗mkPmSlTS 56 of 250 menu

The span tag for pieces of text in HTML

You already know that in order to make a piece of text, for example, bold, you should use the b tag. However, what if I want to color a piece of text red? There is no tag like b for this case.

But there is a special tag span - by itself it does absolutely nothing, but you can apply CSS styles to it, which will allow us to add the desired effect to a piece of text.

Let's look at an example. Let's say we have some text:

<p> This is a paragraph with text. </p>

Let's say we want to make the word "text" red. To do this, we'll wrap this piece of text in the span tag and give this tag some class:

<p> This is a paragraph with <span class="red">text</span>. </p>

Now let's paint the element with this class red:

.red { color: red; }

The following code is given:

<p> Lorem ipsum <span class="xxx">dolor sit</span> amet. </p> <p> <span class="xxx">Lorem ipsum</span> dolor sit amet. </p>

Make elements with class xxx sized at 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