
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
How to use inline CSS (Style Sheet) in HTML?
Cascading Style Sheets is used to format the presentation of a webpage.
CSS is used to style and layout web pages - you can control the presentation of the web page using, to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features available within the css properties.
Inline − Using the style attribute inside HTML elements.
Inline CSS − Inline CSS is used to apply a unique style to a single HTML element used within the tag.
Example
Following is the example program, uses inline CSS for styling in HTML.
<!DOCTYPE html> <html> <head> <h1 style="font-family: fantasy">HTML</h1> </head> <body style="background-color: bisque"> <p style="background:yellow" >HTML is used to structure a web page and its content.</p> </body> </html>
Example
Following is the example program, uses inline CSS for styling for <h1> and <h2> elements.
<!DOCTYPE html> <html> <head> <h1 style="font-family: fantasy">HTML</h1> </head> <body style="background-color: seagreen"> <h2 style="background:whitesmoke" >HTML is used to structure a web page and its content.</h2> </body> </html>
Example
Following is the example program, uses inline CSS for styling for <table> element.
<!DOCTYPE html> <html> <head> <title>Inline CSS</title> </head> <body> <table style = "border: 1px solid";> <tr> <th>Firstname</th> <th>Lastname</th> </tr> <tr> <td>Peter</td> <td>Griffin</td> </tr> <tr> <td>Lois</td> <td>Griffin</td> </tr> </table> </body> </html>
- Related Articles
- How to use internal CSS (Style Sheet) in HTML?
- How to use inline CSS style for an element in HTML?
- How to use CSS style in PowerShell HTML Output?
- How to import styles from another style sheet in CSS
- Rules to override Style Sheet Rule in CSS
- How to apply inline CSS?
- How to remove the space between inline/inline-block elements in HTML?
- Indicate what character set the style sheet written in with CSS
- What are the ways to include style sheet rules in an HTML document
- How to add comments in the style sheet blocks
- How to add an inline layer in HTML?
- Style to highlight active HTML anchor with CSS
- Inline-level Elements and Inline Boxes in CSS
- How to write inline JavaScript code in HTML page?
- How to create a responsive inline form with CSS?

Advertisements