HTML Styles

Links to HTML projects source code & tutorials
Site Admin
Posts: 159
Joined: Sun Jun 26, 2022 10:46 pm

HTML Styles

Post by C0D3D »

Style HTML elements using inline styles - The style attribute

Example 1

Code: Select all

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
    <title>Using Inline Styles in HTML</title>
</head>
<body>
	<h1 style="color:red;font-size:30px;">This is a heading</h1>
    <p style="color:green;font-size:18px;">This is a paragraph.</p>
    <div style="color:green; font-size:18px;">This is some text.</div>
</body>
</html>
Style HTML elements using embedded styles - The style element

Example 2

Code: Select all

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
    <title>Using Embedded Style Sheet in HTML</title>
    <style type="text/css">
        body { background-color: YellowGreen; }
		h1 { color: blue; }
        p { color: red; }
    </style>
</head>
<body>
	<h1>This is a heading</h1>
	<p>This is a paragraph.</p>
</body>
</html>
Link to an external style sheet - The link element

Example 3

Code: Select all

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
    <title>Linking External Style Sheet in HTML</title>
    <link rel="stylesheet" href="/examples/css/style.css">
</head>
<body>
	<h1>Linking External Style Sheet</h1>
   	<p>The styles of this HTML document are defined in linked style sheet.</p>
</body>
</html>
----------------------------------------------------------------------
Together we are one! One we are many... Much Love from one brother to another...
Working together to achieve amazing things!
Teamwork is key.
Knowledge is Power!

4 Basic datatypes.
Strings: Which store a series of characters.
Int: Which store a full integer or number.
Float: A numeric value with a decimal.
Boolean: Only stores True or False and are very useful with if statements

----------------------------------------------------------------------
ImgBB Image upload

Who is online

Users browsing this forum: No registered users and 0 guests