2 way to change your text font-size in HTML?

Spread the love

To change the font-size of text in HTML, you can use the style attribute. the style attribute specifies an inline element of style. The attribute is used with the HTML <h1> tag, with the CSS property  font-size, font-style element , etc.

HTML5 do not support the <font> tag, so the CSS style can be used to change font-size. The <font> tag deprecated in HTML5.

How to change the font-size of text in HTML?

Just keep in mind, the usage of style attribute override any style set globally. It will override any style sheet set in the HTML <style> tag or style sheet.

</pre>
<div class="line number1 index0 alt2"><code class="php plain"><!DOCTYPE html> </code></div>
<div class="line number2 index1 alt1"><code class="php plain"><html> </code></div>
<div class="line number3 index2 alt2"><code class="php plain"><head> </code></div>
<div class="line number4 index3 alt1"><code class="php plain"><title>thewholeblog.com</title> </code></div>
<div class="line number5 index4 alt2"><code class="php plain"></head> </code></div>
<div class="line number6 index5 alt1"><code class="php plain"><style type=</code><code class="php string">"text/css"</code><code class="php plain">> p{ font-size: 20px; } </style> </code></div>
<div class="line number7 index6 alt2"><code class="php plain"><body> </code></div>
<div class="line number8 index7 alt1"><code class="php plain"><p>wholeblog.com></p> </code></div>
<div class="line number9 index8 alt2"><code class="php plain"></body> </code></div>
<div class="line number10 index9 alt1"><code class="php plain"></html></code></div>
<pre>

Centering a few blocks of text

If you have many blocks of text to change font-size use CSS inside tags in the head section or in an external style sheet. See the example code below for how to set all font-size of text inside the tags to be centered.

</pre>
<div class="line number1 index0 alt2"><code class="php plain"><!DOCTYPE html></code></div>
<div class="line number2 index1 alt1"><code class="php plain"><html></code></div>
<div class="line number3 index2 alt2"><code class="php plain"><head></code></div>
<div class="line number4 index3 alt1"><code class="php plain"><title></title></code></div>
<div class="line number5 index4 alt2"><code class="php plain"></head></code></div>
<div class="line number6 index5 alt1"><code class="php plain"><body></code></div>
<div class="line number7 index6 alt2"><code class="php plain"><p style=</code><code class="php string">"font-size: 20px;"</code><code class="php plain">>About Whole Blogs</p></code></div>
<div class="line number8 index7 alt1"><code class="php plain"><p style=</code><code class="php string">"font-size: 12px"</code><code class="php plain">>the whole blogs are </code><code class="php keyword">for</code> <code class="php plain">teaching </code><code class="php keyword">and</code> <code class="php plain">guiding people </code><code class="php keyword">for</code> <code class="php plain">any of the topics like </code></div>
<div class="line number9 index8 alt2"><code class="php plain">Travelling, Technology, Health, Fashion, Beauty, Sports, etc to grow their knowledge about what the world </code></div>
<div class="line number10 index9 alt1"><code class="php plain">had introduced </code><code class="php keyword">and</code> <code class="php plain">what we should learn first from <a href=</code><code class="php string">"<a href="https://wholeblogs.com/">https://wholeblogs.com/</a>"</code><code class="php plain">><b>wholeblogs</b></a>. Whole blogs provide all blogs of technology, </code></div>
<div class="line number11 index10 alt2"><code class="php plain">the latest trends of fashion, </code><code class="php keyword">and</code> <code class="php plain">all other topics on which peoples are interested.</p></code></div>
<div class="line number12 index11 alt1"><code class="php plain"></body></code></div>
<div class="line number13 index12 alt2"><code class="php plain"></html></code></div>
<pre>

read more: change font size

Leave a Comment