

{"id":78504,"date":"2020-06-25T15:48:50","date_gmt":"2020-06-25T10:18:50","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=78504"},"modified":"2024-07-26T15:20:48","modified_gmt":"2024-07-26T09:50:48","slug":"html-styles","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/html-styles\/","title":{"rendered":"HTML Styles Attribute and Its Types"},"content":{"rendered":"<p>Presenting a HTML document on to the browser can be a tedious task if the given HTML document is not attractive. The styles in HTML are rules for making the web-pages more attractive, engaging and presentable.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78681\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style.jpg\" alt=\"HTML Styles\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style-1024x536.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style-520x272.jpg 520w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<h2>HTML Styles Importance<\/h2>\n<p>Let us see why HTML Styles are important:<\/p>\n<ul>\n<li>Provides better formatting and an aesthetic look to the web-pages.<\/li>\n<li>Web-pages can be well-structured as per the developer\u2019s preference.<\/li>\n<li>There is a greater consistency in the design of the web-page.<\/li>\n<li>Provides an engaging and aesthetic user experience.<\/li>\n<\/ul>\n<p>HTML styles are useful in development of good websites as it helps in presentation of good looking and easily navigable websites. When applying styles, one is able to format the webpage in a manner that makes it easy to read and catches the viewer\u2019s attention. In addition, well-designed styles contribute to the professionalism and credibility of a website.<\/p>\n<h2>Ways to implement HTML Styles<\/h2>\n<p>We can implement Styles in HTML 5 in three major ways:<\/p>\n<h3>1. HTML Inline Style<\/h3>\n<p>In inline styling, the properties of CSS are mentioned within the style attribute of the element that needs to be formatted. The style attribute supports multiple properties that are mentioned as \u201cproperty\u2019s name:value\u201d;<\/p>\n<p>For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;  \r\n&lt;html&gt;  \r\n&lt;head&gt;  \r\n&lt;title&gt;DataFlair&lt;\/title&gt;  \r\n&lt;\/head&gt;  \r\n&lt;body&gt;\r\n&lt;h1 style=\"text-align: center;\"&gt;&lt;u&gt;&lt;i&gt; Welcome to DataFlair&lt;\/i&gt;&lt;\/u&gt;&lt;\/h1&gt; \r\n&lt;h2 style=\"text-align: center;\"&gt;&lt;u&gt;About Us&lt;\/u&gt;&lt;\/h2&gt; \r\n&lt;p style=\"text-align: center; color: blue; font-size: 20px; font-family: cursive;\"&gt;\r\nWe continuously work hard to bring you the best trainers to enable your smooth learning at your home as per your convenience. This is the reason why most of the DataFlair students get placed in top MNCs in Big Data just after the training.\r\nDataFlair team comprises of trainers who are experts in their relevant technologies and are selected after many rounds of interviews, content team that continuously works hard to provide quality content to the readers, Marketing team that work hand in hand with other teams to make the content reaches the right audience and HR team that work to extend the team and to provide a healthy work environment.\r\n&lt;\/p&gt;\r\n&lt;\/body&gt;  \r\n&lt;\/html&gt;  \r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78682\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279.png\" alt=\"HTML Style\" width=\"1262\" height=\"437\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279.png 1262w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-300x104.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-1024x355.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-150x52.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-768x266.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-520x180.png 520w\" sizes=\"auto, (max-width: 1262px) 100vw, 1262px\" \/><\/a><\/p>\n<h4>Advantages of Inline Styles:<\/h4>\n<ul>\n<li>Inline styles have the highest precedence i.e they execute before the external or internal stylesheets.<\/li>\n<li>Inline styles can be added quickly and easily to the element that needs to be formatted, a new document does not have to be created.<\/li>\n<\/ul>\n<h4>Disadvantages of Inline Styling:<\/h4>\n<ul>\n<li>They tend to override element properties that the developer may not intend to.<\/li>\n<li>If only inline styles are used, HTML documents would become hard-coded and very difficult to maintain.<\/li>\n<li>If a single style needs to be added to a group of elements, they will have to be added to each and every element belonging to that group. For example, if all the paragraph tags should be center-aligned, each and every paragraph element needs to be found first and then its text-align property should be set to center. This becomes quite cumbersome.<\/li>\n<\/ul>\n<h3>2. Internal Style Sheet in HTML<\/h3>\n<p>HTML Internal style sheets are embedded within the document that needs to be styled. It is coded in the &lt;style&gt; element within the &lt;head&gt; section.<\/p>\n<p>For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;  \r\n&lt;html&gt;  \r\n&lt;head&gt;  \r\n&lt;title&gt;DataFlair&lt;\/title&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\nh1,h2{\r\ntext-align: center;\r\n}\r\np{\r\ntext-align: center; \r\ncolor: blue; \r\nfont-size: 20px; \r\nfont-family: cursive;\r\n}\r\n&lt;\/style&gt;  \r\n&lt;\/head&gt;  \r\n&lt;body&gt;\r\n&lt;h1&gt;&lt;u&gt;&lt;i&gt; Welcome to DataFlair&lt;\/i&gt;&lt;\/u&gt;&lt;\/h1&gt; \r\n&lt;h2&gt;&lt;u&gt;About Us&lt;\/u&gt;&lt;\/h2&gt; \r\n&lt;p&gt;\r\nWe continuously work hard to bring you the best trainers to enable your smooth learning at your home as per your convenience. This is the reason why most of the DataFlair students get placed in top MNCs in Big Data just after the training.\r\nDataFlair team comprises of trainers who are experts in their relevant technologies and are selected after many rounds of interviews, content team that continuously works hard to provide quality content to the readers, Marketing team that work hand in hand with other teams to make the content reaches the right audience and HR team that work to extend the team and to provide a healthy work environment.\r\n&lt;\/p&gt;\r\n&lt;\/body&gt;  \r\n&lt;\/html&gt;  \r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78683\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-1.png\" alt=\"Styles in HTML\" width=\"1262\" height=\"437\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-1.png 1262w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-1-300x104.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-1-1024x355.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-1-150x52.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-1-768x266.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-1-520x180.png 520w\" sizes=\"auto, (max-width: 1262px) 100vw, 1262px\" \/><\/a><\/p>\n<h4>Advantages of Internal Style Sheet<\/h4>\n<ul>\n<li>We can style Multiple elements using the internal or embedded style sheets.<\/li>\n<li>Id and class selectors can be used very efficiently.<\/li>\n<li>There is no need to insert multiple files in order to style the HTML document.<\/li>\n<\/ul>\n<h4>Disadvantages of HTML Internal Style Sheet<\/h4>\n<ul>\n<li>It increases the size of code and is the second preference, after inline style.<\/li>\n<li>It can increase the page\u2019s loading time.<\/li>\n<\/ul>\n<h3>3. HTML External Style Sheet<\/h3>\n<p>An external style sheet in HTML contains all the styling attributes in a separate document(extension .css). This document is linked to the HTML documents that need those rules of style. There are two ways of linking the style sheet.<\/p>\n<h4>a. The &lt;link&gt; tag within &lt;head&gt; section<\/h4>\n<p>We will be linking style.css<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">h1,h2{\r\ntext-align: center;\r\n}\r\np{\r\ntext-align: center; \r\ncolor: blue; \r\nfont-size: 20px; \r\nfont-family: cursive;\r\n}\r\n<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;  \r\n&lt;html&gt;  \r\n&lt;head&gt;  \r\n&lt;title&gt;DataFlair&lt;\/title&gt;\r\n&lt;link rel=\"stylesheet\" type=\"text\/css\" href=\"style.css\"&gt;\r\n&lt;\/style&gt;  \r\n&lt;\/head&gt;  \r\n&lt;body&gt;\r\n&lt;h1&gt;&lt;u&gt;&lt;i&gt; Welcome to DataFlair&lt;\/i&gt;&lt;\/u&gt;&lt;\/h1&gt; \r\n&lt;h2&gt;&lt;u&gt;About Us&lt;\/u&gt;&lt;\/h2&gt; \r\n&lt;p&gt;\r\nWe continuously work hard to bring you the best trainers to enable your smooth learning at your home as per your convenience. This is the reason why most of the DataFlair students get placed in top MNCs in Big Data just after the training.\r\nDataFlair team comprises of trainers who are experts in their relevant technologies and are selected after many rounds of interviews, content team that continuously works hard to provide quality content to the readers, Marketing team that work hand in hand with other teams to make the content reaches the right audience and HR team that work to extend the team and to provide a healthy work environment.\r\n&lt;\/p&gt;\r\n&lt;\/body&gt;  \r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78684\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-2.png\" alt=\"HTML styling\" width=\"1262\" height=\"437\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-2.png 1262w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-2-300x104.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-2-1024x355.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-2-150x52.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-2-768x266.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-2-520x180.png 520w\" sizes=\"auto, (max-width: 1262px) 100vw, 1262px\" \/><\/a><\/p>\n<h4>b. Importing the HTML style sheet<\/h4>\n<p>Styles can also be applied using the \u2018@import\u2019 keyword, followed by the URL of the CSS file. The browser is instructed to load the CSS file using this keyword.<\/p>\n<p>For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Styles can also be applied using the \u2018@import\u2019 keyword, followed by the URL of the CSS file. The browser is instructed to load the CSS file using this keyword.\r\nFor example,\r\nCode-\r\n&lt;!DOCTYPE html&gt;  \r\n&lt;html&gt;  \r\n&lt;head&gt;  \r\n&lt;title&gt;DataFlair&lt;\/title&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n@import url(\"style.css\");\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;  \r\n&lt;body&gt;\r\n&lt;h1&gt;&lt;u&gt;&lt;i&gt; Welcome to DataFlair&lt;\/i&gt;&lt;\/u&gt;&lt;\/h1&gt; \r\n&lt;h2&gt;&lt;u&gt;About Us&lt;\/u&gt;&lt;\/h2&gt; \r\n&lt;p&gt;\r\nWe continuously work hard to bring you the best trainers to enable your smooth learning at your home as per your convenience. This is the reason why most of the DataFlair students get placed in top MNCs in Big Data just after the training.\r\nDataFlair team comprises of trainers who are experts in their relevant technologies and are selected after many rounds of interviews, content team that continuously works hard to provide quality content to the readers, Marketing team that work hand in hand with other teams to make the content reaches the right audience and HR team that work to extend the team and to provide a healthy work environment.\r\n&lt;\/p&gt;\r\n&lt;\/body&gt;  \r\n&lt;\/html&gt;  \r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78685\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-3.png\" alt=\"styling in html\" width=\"1262\" height=\"437\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-3.png 1262w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-3-300x104.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-3-1024x355.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-3-150x52.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-3-768x266.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-279-3-520x180.png 520w\" sizes=\"auto, (max-width: 1262px) 100vw, 1262px\" \/><\/a><\/p>\n<h4><strong>Advantages<\/strong><\/h4>\n<ul>\n<li>We can manipulate styles of many documents using a single file.<\/li>\n<li>Classes and Ids are useful to access and manipulate the styles of various HTML elements.<\/li>\n<li>Selector and grouping methods can be used for applying the styles.<\/li>\n<\/ul>\n<h4>Disadvantages<\/h4>\n<ul>\n<li>Extra downloading required.<\/li>\n<li>Document cannot be rendered until the style sheet has been loaded.<\/li>\n<li>Not viable for less style definitions.<\/li>\n<\/ul>\n<h2>Most Commonly used HTML Style Properties<\/h2>\n<p>The style attribute is useful to add styles to the HTML document. As discussed before, it comes with \u201cproperty:value\u201d properties.<\/p>\n<p>Some common properties of the style attribute are:<\/p>\n<h3>1. background-color<\/h3>\n<p>Used to set the background color of an element. For example,<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;  \r\n&lt;html&gt;  \r\n&lt;head&gt;  \r\n&lt;title&gt;DataFlair&lt;\/title&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n@import url(\"style.css\");\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;  \r\n&lt;body&gt;\r\n&lt;h1&gt;&lt;u&gt;&lt;i&gt; Welcome to DataFlair&lt;\/i&gt;&lt;\/u&gt;&lt;\/h1&gt; \r\n&lt;h2&gt;&lt;u&gt;About Us&lt;\/u&gt;&lt;\/h2&gt; \r\n&lt;p style=\"background-color: yellow;\"&gt;\r\nWe continuously work hard to bring you the best trainers to enable your smooth learning at your home as per your convenience. This is the reason why most of the DataFlair students get placed in top MNCs in Big Data just after the training.\r\nDataFlair team comprises of trainers who are experts in their relevant technologies and are selected after many rounds of interviews, content team that continuously works hard to provide quality content to the readers, Marketing team that work hand in hand with other teams to make the content reaches the right audience and HR team that work to extend the team and to provide a healthy work environment.\r\n&lt;\/p&gt;\r\n&lt;\/body&gt;  \r\n&lt;\/html&gt;  \r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-281.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78686\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-281.png\" alt=\"HTML background colour\" width=\"1268\" height=\"535\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-281.png 1268w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-281-300x127.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-281-1024x432.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-281-150x63.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-281-768x324.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-281-520x219.png 520w\" sizes=\"auto, (max-width: 1268px) 100vw, 1268px\" \/><\/a><\/p>\n<h3>2. text-color<\/h3>\n<p>Used to set the colour of the text. For example,<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;  \r\n&lt;html&gt;  \r\n&lt;head&gt;  \r\n&lt;title&gt;DataFlair&lt;\/title&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n@import url(\"style.css\");\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;  \r\n&lt;body&gt;\r\n&lt;h1&gt;&lt;u&gt;&lt;i&gt; Welcome to DataFlair&lt;\/i&gt;&lt;\/u&gt;&lt;\/h1&gt; \r\n&lt;h2&gt;&lt;u&gt;About Us&lt;\/u&gt;&lt;\/h2&gt; \r\n&lt;p style=\"color: red;\"&gt;\r\nWe continuously work hard to bring you the best trainers to enable your smooth learning at your home as per your convenience. This is the reason why most of the DataFlair students get placed in top MNCs in Big Data just after the training.\r\nDataFlair team comprises of trainers who are experts in their relevant technologies and are selected after many rounds of interviews, content team that continuously works hard to provide quality content to the readers, Marketing team that work hand in hand with other teams to make the content reaches the right audience and HR team that work to extend the team and to provide a healthy work environment.\r\n&lt;\/p&gt;\r\n&lt;\/body&gt;  \r\n&lt;\/html&gt;  \r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-283.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78687\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-283.png\" alt=\"HTML Font color\" width=\"1260\" height=\"416\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-283.png 1260w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-283-300x99.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-283-1024x338.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-283-150x50.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-283-768x254.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-283-520x172.png 520w\" sizes=\"auto, (max-width: 1260px) 100vw, 1260px\" \/><\/a><\/p>\n<h3>3. font-family<\/h3>\n<p>It is to set the type of font. For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;  \r\n&lt;html&gt;  \r\n&lt;head&gt;  \r\n&lt;title&gt;DataFlair&lt;\/title&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n@import url(\"style.css\");\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;  \r\n&lt;body&gt;\r\n&lt;h1&gt;&lt;u&gt;&lt;i&gt; Welcome to DataFlair&lt;\/i&gt;&lt;\/u&gt;&lt;\/h1&gt; \r\n&lt;h2&gt;&lt;u&gt;About Us&lt;\/u&gt;&lt;\/h2&gt; \r\n&lt;p style=\"font-family: verdana\"&gt;\r\nWe continuously work hard to bring you the best trainers to enable your smooth learning at your home as per your convenience. This is the reason why most of the DataFlair students get placed in top MNCs in Big Data just after the training.\r\nDataFlair team comprises of trainers who are experts in their relevant technologies and are selected after many rounds of interviews, content team that continuously works hard to provide quality content to the readers, Marketing team that work hand in hand with other teams to make the content reaches the right audience and HR team that work to extend the team and to provide a healthy work environment.\r\n&lt;\/p&gt;\r\n&lt;\/body&gt;  \r\n&lt;\/html&gt;  \r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-285.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78688\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-285.png\" alt=\"HTML font family\" width=\"1270\" height=\"293\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-285.png 1270w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-285-300x69.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-285-1024x236.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-285-150x35.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-285-768x177.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-285-520x120.png 520w\" sizes=\"auto, (max-width: 1270px) 100vw, 1270px\" \/><\/a><\/p>\n<h3>4. text-size<\/h3>\n<p>We can adjust the text-size using the font-size property. For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;  \r\n&lt;html&gt;  \r\n&lt;head&gt;  \r\n&lt;title&gt;DataFlair&lt;\/title&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n@import url(\"style.css\");\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;  \r\n&lt;body&gt;\r\n&lt;h1&gt;&lt;u&gt;&lt;i&gt; Welcome to DataFlair&lt;\/i&gt;&lt;\/u&gt;&lt;\/h1&gt; \r\n&lt;h2&gt;&lt;u&gt;About Us&lt;\/u&gt;&lt;\/h2&gt; \r\n&lt;p style=\"font-size: 200%\"&gt;\r\nWe continuously work hard to bring you the best trainers to enable your smooth learning at your home as per your convenience. This is the reason why most of the DataFlair students get placed in top MNCs in Big Data just after the training.\r\nDataFlair team comprises of trainers who are experts in their relevant technologies and are selected after many rounds of interviews, content team that continuously works hard to provide quality content to the readers, Marketing team that work hand in hand with other teams to make the content reaches the right audience and HR team that work to extend the team and to provide a healthy work environment.\r\n&lt;\/p&gt;\r\n&lt;\/body&gt;  \r\n&lt;\/html&gt;  \r\n<\/pre>\n<p>The font-size can be specified in percentages or pixels(e.g., 20px).<br \/>\n<strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-287.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78689\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-287.png\" alt=\"HTML text size\" width=\"1266\" height=\"591\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-287.png 1266w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-287-300x140.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-287-1024x478.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-287-150x70.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-287-768x359.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-287-520x243.png 520w\" sizes=\"auto, (max-width: 1266px) 100vw, 1266px\" \/><\/a><\/p>\n<h3>5. text-align<\/h3>\n<p>HTML text-align property is useful to align the content of an element.<\/p>\n<p>For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;  \r\n&lt;html&gt;  \r\n&lt;head&gt;  \r\n&lt;title&gt;DataFlair&lt;\/title&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n@import url(\"style.css\");\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;  \r\n&lt;body&gt;\r\n&lt;h1 style=\"text-align: center;\"&gt;&lt;u&gt;&lt;i&gt; Welcome to DataFlair&lt;\/i&gt;&lt;\/u&gt;&lt;\/h1&gt; \r\n&lt;h2 style=\"text-align: center;\"&gt;&lt;u&gt;About Us&lt;\/u&gt;&lt;\/h2&gt; \r\n&lt;p style=\"text-align: center;\"&gt;\r\nWe continuously work hard to bring you the best trainers to enable your smooth learning at your home as per your convenience. This is the reason why most of the DataFlair students get placed in top MNCs in Big Data just after the training.\r\nDataFlair team comprises of trainers who are experts in their relevant technologies and are selected after many rounds of interviews, content team that continuously works hard to provide quality content to the readers, Marketing team that work hand in hand with other teams to make the content reaches the right audience and HR team that work to extend the team and to provide a healthy work environment.\r\n&lt;\/p&gt;\r\n&lt;\/body&gt;  \r\n&lt;\/html&gt;  \r\n<\/pre>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-289.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78690\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-289.png\" alt=\"HTML text align\" width=\"1262\" height=\"264\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-289.png 1262w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-289-300x63.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-289-1024x214.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-289-150x31.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-289-768x161.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Screenshot-289-520x109.png 520w\" sizes=\"auto, (max-width: 1262px) 100vw, 1262px\" \/><\/a><\/p>\n<p>HTML styles are significant for any person who has to develop a web page or a web site to be appealing to the users. With inline, internal and external styles, a developer is able to develop web pages while observing proper standards of aesthetics as well as other factors like ease of maintaining the web page.<\/p>\n<h2>Summary<\/h2>\n<p>In this article, we have learned about the HTML style attributes along with different ways to style an HTML document. We looked at three ways of adding styles to our documents &#8211; inline style, internal style and external style sheets. We\u2019ve also looked at some of the most basic style attribute\u2019s properties, background-color,color,font-family,font-size and text-align.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Presenting a HTML document on to the browser can be a tedious task if the given HTML document is not attractive. The styles in HTML are rules for making the web-pages more attractive, engaging&#46;&#46;&#46;<\/p>\n","protected":false},"author":10,"featured_media":78681,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22400],"tags":[32748,32749,22455,32746,32747],"class_list":["post-78504","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html","tag-html-external-style-sheet","tag-html-style-properties","tag-html-styles","tag-html-styles-attribute","tag-internal-style-sheet-in-html"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>HTML Styles Attribute and Its Types - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn HTML styles &amp; Its importance,types - inline style, internal style and external style sheets, basic style attribute\u2019s properties,color,font-family, etc\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/html-styles\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HTML Styles Attribute and Its Types - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn HTML styles &amp; Its importance,types - inline style, internal style and external style sheets, basic style attribute\u2019s properties,color,font-family, etc\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/html-styles\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-25T10:18:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-26T09:50:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HTML Styles Attribute and Its Types - DataFlair","description":"Learn HTML styles & Its importance,types - inline style, internal style and external style sheets, basic style attribute\u2019s properties,color,font-family, etc","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/html-styles\/","og_locale":"en_US","og_type":"article","og_title":"HTML Styles Attribute and Its Types - DataFlair","og_description":"Learn HTML styles & Its importance,types - inline style, internal style and external style sheets, basic style attribute\u2019s properties,color,font-family, etc","og_url":"https:\/\/data-flair.training\/blogs\/html-styles\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-06-25T10:18:50+00:00","article_modified_time":"2024-07-26T09:50:48+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/html-styles\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/html-styles\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33"},"headline":"HTML Styles Attribute and Its Types","datePublished":"2020-06-25T10:18:50+00:00","dateModified":"2024-07-26T09:50:48+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/html-styles\/"},"wordCount":841,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/html-styles\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style.jpg","keywords":["HTML External Style Sheet","HTML Style Properties","html styles","HTML Styles Attribute","Internal Style Sheet in HTML"],"articleSection":["HTML Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/html-styles\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/html-styles\/","url":"https:\/\/data-flair.training\/blogs\/html-styles\/","name":"HTML Styles Attribute and Its Types - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/html-styles\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/html-styles\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style.jpg","datePublished":"2020-06-25T10:18:50+00:00","dateModified":"2024-07-26T09:50:48+00:00","description":"Learn HTML styles & Its importance,types - inline style, internal style and external style sheets, basic style attribute\u2019s properties,color,font-family, etc","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/html-styles\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/html-styles\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/html-styles\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Style.jpg","width":1200,"height":628,"caption":"HTML Styles"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/html-styles\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"HTML Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/html\/"},{"@type":"ListItem","position":3,"name":"HTML Styles Attribute and Its Types"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team is passionate about delivering top-notch tutorials and resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With expertise in the tech industry, we simplify complex topics to help learners excel. Stay updated with our latest insights.","url":"https:\/\/data-flair.training\/blogs\/author\/dfadteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/78504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=78504"}],"version-history":[{"count":4,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/78504\/revisions"}],"predecessor-version":[{"id":142947,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/78504\/revisions\/142947"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/78681"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=78504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=78504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=78504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}