changing Font size in html style attribute

difference between both and why we use the % symbol and what does it means?

<p style="font-size:160%;">This is a paragraph.</p>

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

>Solution :

The first one has the style attribute (CSS) of font-size:160% it sets the font-size property to 160%.
% is a relative CSS unit, it will set the font size to 160 percentage of the parent element.

<div style="font-size:24px;">
  <p style="font-size:160%;">This is a paragraph with 160% of the font size of parent div</p>
  <p>This is a paragraph with the font size of the parent div</p>

Leave a Reply