HTML DOCUMENT ALIGN
&
(FONT,SIZE WITH ALIGNMENT)
Submitted by: GAYATHIRI.B
Department: bachelor of computer application(BCA).
Submitted: MR. R .Selvam,MCA.,M.PHIL.,
Date on :29.02.2024
Reference ID:
https://www.w3schools.com/cssref/pr_text_text-
align.php
, HTML DOCUMENT ALIGN
&
(FONT,SIZE WITH ALIGNMENT)
While HTML offers limited capabilities for directly aligning and sizing fonts with a single
element, it provides a foundation for styling your content through CascadingStyleSheets(CSS).
Here's how to achieve font alignment and size using HTML and CSS:
1.DefiningFontSize:
● Use the <font> tag with the size attribute in HTML (deprecated):
HTML
<font size="5">This text will be larger.</font>
However,thismethodisdiscouragedduetolackofaccessibilityandflexibility.
● Instead, use CSS to define font sizes in various units like pixels (px), points (pt), or relative
units (em, rem):
CSS
p { font-size: 16px; /* Set font size to 16 pixels */ }
h1 { font-size: 2em; /* Set font size to twice the parent element's font size */ }
2.AligningText:
● Use the align attribute with HTML elements (deprecated):
HTML
<p align="center">This text will be centered.</p>
Similar to font size, using align is also discouraged
&
(FONT,SIZE WITH ALIGNMENT)
Submitted by: GAYATHIRI.B
Department: bachelor of computer application(BCA).
Submitted: MR. R .Selvam,MCA.,M.PHIL.,
Date on :29.02.2024
Reference ID:
https://www.w3schools.com/cssref/pr_text_text-
align.php
, HTML DOCUMENT ALIGN
&
(FONT,SIZE WITH ALIGNMENT)
While HTML offers limited capabilities for directly aligning and sizing fonts with a single
element, it provides a foundation for styling your content through CascadingStyleSheets(CSS).
Here's how to achieve font alignment and size using HTML and CSS:
1.DefiningFontSize:
● Use the <font> tag with the size attribute in HTML (deprecated):
HTML
<font size="5">This text will be larger.</font>
However,thismethodisdiscouragedduetolackofaccessibilityandflexibility.
● Instead, use CSS to define font sizes in various units like pixels (px), points (pt), or relative
units (em, rem):
CSS
p { font-size: 16px; /* Set font size to 16 pixels */ }
h1 { font-size: 2em; /* Set font size to twice the parent element's font size */ }
2.AligningText:
● Use the align attribute with HTML elements (deprecated):
HTML
<p align="center">This text will be centered.</p>
Similar to font size, using align is also discouraged