Skip to content

Buzzingz

Unleashing the Power of Code

  • HTML
  • CSS
  • JavaScript
  • Toggle search form

HTML Styles – CSS

Posted on March 4, 2023April 1, 2023 By shani No Comments on HTML Styles – CSS

HTML provides a way to add style and layout to web pages through Cascading Style Sheets (CSS). CSS is a styling language that is utilized to define how an HTML page should appear and be presented to the user.

CSS separates the presentation of the web page from its content, making it easier to change the layout and appearance of a web page without changing its underlying HTML code. With CSS, you can control the font size, color, spacing, background color, border, and other visual elements of the web page.

Here’s an example of how to apply a style to an HTML element using CSS:

<!DOCTYPE html>
<html>
<head>
	<style>
		h1 {
			color: red;
			font-size: 36px;
			font-family: Arial, sans-serif;
			text-align: center;
			text-decoration: underline;
		}
	</style>
</head>
<body>
	<h1>Welcome to my website!</h1>
	<p>This is some sample text.</p>
</body>
</html>


In this example, the h1 element is styled using CSS. The color property sets the color of the text to red, the font-size property sets the font size to 36 pixels, the font-family property sets the font family to Arial or sans-serif if Arial is not available, the text-align property centers the text, and the text-decoration property adds an underline to the text.

You can also use external CSS files to apply styles to multiple pages of a website. To do this, you would create a separate CSS file with the styles and link it to the HTML pages using the link element in the head section of the HTML code.

<!DOCTYPE html>
<html>
<head>
	<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
	<h1>Welcome to my website!</h1>
	<p>This is some sample text.</p>
</body>
</html>

In this example, the link element links to an external CSS file called style.css. This file contains the CSS styles for the web page and can be reused on other pages of the website.

HTML

Post navigation

Previous Post: HTML Colors
Next Post: HTML Links

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

HTML Tutorial

  • HTML History
  • HTML Editors
  • What is an HTML Element?
  • HTML Attributes
  • HTML Headings
  • HTML Paragraphs
  • HTML Styles
  • HTML Text Formatting
  • HTML Quotation and Citation Elements
  • HTML Comments
  • HTML Colors
  • HTML Styles – CSS
  • HTML Links
  • HTML images
  • HTML Favicon
  • HTML Tables
    • HTML Table Colgroup
    • HTML Table Colspan and Rowspan
    • HTML Table Headers
    • HTML Table Padding and Spacing
    • HTML Table Sizes
    • HTML Table Styling
  • HTML List
  • HTML Ordered Lists
  • HTML Unordered List
  • HTML other lists
  • HTML Block and Inline Elements
  • HTML class Attribute
  • HTML id Attribute
  • HTML Iframes
  • HTML JavaScript
  • HTML File Paths
  • HTML – The Head Element
  • HTML Layout Elements and Techniques
  • HTML Responsive Web Design
  • HTML Computer Code Elements
  • HTML Semantic Elements
  • HTML Style Guide
  • HTML Entities
  • HTML Symbols
  • HTML Emojis
  • HTML Encoding (Character Sets)
  • HTML Uniform Resource Locators(URL)
  • HTML Versus XHTML
  • HTML Forms
  • HTML Form Attributes
  • HTML Form Elements
  • HTML Form Target Attribute
  • HTML Input Attributes
  • HTML Input form Attributes
  • HTML Input Types
  • HTML Canvas Graphics
  • HTML SVG Graphics
  • HTML Multimedia
  • HTML Video
  • HTML Audio
  • HTML Plug-ins
  • HTML YouTube Videos
  • HTML Geolocation API
  • HTML Drag and Drop API
  • HTML Web Storage API
  • HTML Web Workers API
  • HTML SSE API
  • About Us
  • Contact Us
  • Privacy Policy
  • Terms & Conditions

Copyright © 2023 Buzzingz.

Powered by PressBook WordPress theme