What are HTML Styles?
In HTML, The tag <p> is used to define a paragraph.
Important Points
- You can put HTML Styles in all types of HTML-Elements.
- HTML Styles provide additional information to HTML-Elements.
- HTML Styles should always be declare in the starting tags.
- More thsqan 100 HTML Styles can be written in a the same starting tag.
- HTML Styles are always written in (name="value") Ex: <p title="Codingwith Anas">Codingwith Anas</p>.
What HTML Styles Can Do
Style made this paragraph red!
Style made this heading green!
Style made this heading biggers and blue!
HTML Style-Attribute
The Attribute style="" is used to apply CSS to a single HTML-Elements directly and this using of CSS directly to an HTML-Element is knows as "Inline-CSS".
<p style="color: blue;">CWA is short form of "Codingwith Anas"</p>
Background Color Property
The background-color property of CSS is used to add background color to an HTML-Elements.
<body styles="background-color: red;">The background color have been applied</body>
Text Color Property
The color property of CSS is used to add color to text in HTML-Elements.
<p style="color: maroon;">CWA is the best learning platform</p>
Font Size Property
The font-size property of CSS is used to set size of a text in HTML-Elements.
<p style="font-size: 20px;">CWA also designs & develops sites</p>
Font Family Property
The font-family property of CSS is used to change font style of a text in HTML-Elements.
<p>Normal Font</p>
<p style="font-family: cursive;">Edited Font</p>
Text Align Property
The text-align property of CSS is used to set alignment of text horizontally of an HTML-Elements.
<p style="text-align: center;">You can set it to "left" or "right" too</p>