<!DOCTYPE html>
<html>
<head><title>Title</title></head>
<body>
<h1><font color="red">Red Heading with Html Only</font></h1>
</body>
</html>
This HTML code create a simple webpage with a single red heading using old school pure html approach. Usage of CSS can make your website more organized and easier to update.
<!DOCTYPE html>
<html>
<head><title>Title</title>
<style>
h1 {
color: red;
}
p {
background: yellow;
}
</style>
</head>
<body>
<h1>Red Heading with Css</h1>
<p>Normal text - yellow background</p>
</body>
</html>
This HTML code creates a simple webpage with a red heading and a paragraph of text with a yellow background, using CSS styles applied within the <style>
tags.
The first part of the code is standard HTML, with a DOCTYPE declaration, an <html>
tag, a <head>
section containing a <title>
element, and a <body>
section where the content of the webpage is defined.
The CSS styles are defined within the <style>
tags in the <head>
section. The styles apply to the <h1>
and <p>
elements, using selectors to target these specific tags. The color
property is used to set the text color of the <h1>
tag to red, while the background
property is used to set the background color of the <p>
tag to yellow.
Finally, the content of the webpage is defined within the <body>
tags. The heading and paragraph of text are simply defined using standard HTML tags.
This code demonstrates the basic use of CSS to style HTML elements on a webpage, with the ability to change text color, background color, and other visual aspects of the content.
No comments:
Post a Comment