HTML Basic Examples
Certainly! Here are some basic HTML examples to help you get started with creating web pages. HTML (Hypertext Markup Language) is the standard language for creating web pages. You can create HTML files using a text editor like Notepad on Windows, TextEdit on macOS, or any code editor of your choice.
- Creating a Basic HTML Document:
My First Web Page
Hello, World!
This is a basic HTML page.
In this example:
<!DOCTYPE html>
declares the document type and version.<html>
is the root element that contains all the HTML content.<head>
contains meta-information about the document, such as the title.<title>
sets the title displayed in the browser’s tab.<body>
contains the visible content of the web page.<h1>
is a heading element.<p>
is a paragraph element.
- Adding Images:
Image Example
My Image
In this example, the <img>
element is used to display an image. src
points to the image file, and alt
provides alternative text for screen readers and if the image cannot be displayed.
- Creating Links:
Link Example
My Links
Visit Example.com
The <a>
element creates a hyperlink. href
specifies the URL to link to.
- Creating Lists:
List Example
My List
- Item 1
- Item 2
- First
- Second
<ul>
creates an unordered list (bulleted).<ol>
creates an ordered list (numbered).<li>
creates list items.
- Adding Styles with CSS:
CSS Example
Styled Heading
This paragraph has a larger font size and blue heading.
In this example, we use an inline <style>
element to apply CSS styles to the HTML elements.
These are just a few basic examples to get you started with HTML. As you progress, you can explore more HTML tags and CSS to create more complex and styled web pages.
Conclusion
These are just a few basic examples to get you started with HTML. As you progress, you can explore more HTML tags and CSS to create more complex and styled web pages.