The HTML element's style attribute is used in applying basic and inline styling or CSS to an element.
It's value is usually one or more styles that should be applied to an elements. Each of these stylings are defined in the name:value
pair while separating each individual style to apply on an element from the other with a semi - colon (;) in accordance to CSS standard.
You will learn all about the use and application of CSS in the CSS tutorials.
<p style='color:blue; font-size:3em; margin:3%;'>Hello World</p>
<button style='border:1px solid blue; outline:none; padding:10px;'>Click Me</button>
Copy PRACTICE IT
- The HTML style attribute is used in defining styles directly on an HTML element.
- The attribute value contains one or more styles separated by a semi - colon (;) and in standard with CSS styling.
- All HTML elements can have the style attribute but styles can not be interpreted on all HTML elements. For example, it doesn't make sense for the <title> element to have stylings.