HTML Basic Examples
Hi Guys! Hope so you are fine.
Now we go on next step
Don’t worry if these examples use tags you have not learned.
You will learn about them in the upcoming Posts.
<a href="http://www.codeneat.com">This is a link</a>
The links represent is specified in the(Hyperlink Reference) href attribute.
Attributes are used to provide additional information about HTML5 elements or webpage.
What is HTML Images
HTML images are defined with the tag of <img> tag.
The source file (src), alternative text (alt), width, and height are provided as attributes:
<img src="Codeneat.jpg" alt="http://www.codeneat.com" width="105" height="140">
What is HTML Elements
An HTML element usually consists of a starting tag and ending tag, with the content inserted between them:
The HTML element is everything from the start tag to the end tag og the page:
What is Nested HTML Elements
HTML elements can be nested (elements can contain elements or Element within an Element is called nested element).
Every HTML document consist of nested HTML elements.
This example shows 4 HTML elements:
<body><h1>My 1st Heading</h1>
<p>My Sample paragraph.</p></body>
Explaination of Example
The <html> element identify that HTML based document .
It must be start with tag <html> and end tag </html>.
The element content is another HTML element (the <body> element where we can write content ).
<h1>My st Heading</h1>
<p>My Sample paragraph.</p>
- Every HTML elements can have attributes
- Attributes provide additional information about the element
- Attributes are always represented in the start tag
- Attributes mostly come in name/value pairs like: name=”value”
The href Attribute
HTML links are defined with the <a> tag. The link address is specified in the href attribute:
The src Attribute
HTML images are defined with <img> tag which is specified for image .
The filename of the image source is specified with src attribute:
What is the width and height Attributes
Images in HTML having set of size attributes, which specifies the width and height of the image tag:
<img src=”img_boy.jpg” width=”400″ height=”500″>
The image size is specified in pixels: width=”400″ means 400 pixels wide.
What is alt Attribute
The alt attribute specifies the alternative text which is to be used when the image cannot be displayed on the screen.
The value of the attributes can be read by the screen reader or user of the site.
<img src=”img_boy.jpg” alt=”Boy with a jacket”>