Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Apply CSS3 styles to HTML
#1
Assumed you have an HTML5 document and a separated CSS3 file, the example would be:

HTML part:

<!DOCTYPE html>
<html>
<head>
  <title>Applying Styles to HTML Example</title>
  <link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
  <h1>Welcome to My Website</h1>
  <p>This is a paragraph with some text.</p>
</body>
</html>

CSS part:

/* styles.css */
h1 {
  color: blue;
  text-align: center;
}

p {
  font-size: 16px;
}

Explanation:

To apply CSS styles to HTML, we create a separate CSS file (styles.css in this example) and link it to the HTML document using the <link> element. In the CSS file, we define styles for the h1 element to set the text color to blue and center align the text. Additionally, we apply a font size of 16 pixels to all p elements.
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Messages In This Thread
Apply CSS3 styles to HTML - by Qomplainerz - 07-26-2023, 06:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  CSS Custom Scrollbar Styles (Webkit and Firefox) Qomplainerz 0 448 07-26-2023, 07:52 PM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 5 Guest(s)