0% found this document useful (0 votes)
40 views4 pages

Internet Based Prog

The document discusses several key HTML elements and attributes. It describes common elements like <h1>, <p>, and <img> and attributes like href, src, alt, and style. It provides examples of how to use these elements and attributes, such as linking to other pages with <a href> and embedding images with <img src>. It also summarizes how to use the style attribute to specify properties like color, font, size, and alignment for HTML elements.

Uploaded by

Otara Dan5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views4 pages

Internet Based Prog

The document discusses several key HTML elements and attributes. It describes common elements like <h1>, <p>, and <img> and attributes like href, src, alt, and style. It provides examples of how to use these elements and attributes, such as linking to other pages with <a href> and embedding images with <img src>. It also summarizes how to use the style attribute to specify properties like color, font, size, and alignment for HTML elements.

Uploaded by

Otara Dan5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

HTML ELEMENTS

element is the root element and it defines the whole HTML document

<tagname>Content goes here...</tagname>


Examples of some HTML elements:

<h1>My First Heading</h1>


<p>My first paragraph.</p>

HTML Attributes
HTML attributes provide additional information about HTML elements.

The href Attribute


The <a> tag defines a hyperlink. The href attribute specifies the URL of the page
the link goes to:

<a href="https://www.w3schools.com">Visit W3Schools</a>

The src Attribute


The <img> tag is used to embed an image in an HTML page. The src attribute
specifies the path to the image to be displayed:

<img src="img_girl.jpg">

There are two ways to specify the URL in the src attribute:

1. Absolute URL - Links to an external image that is hosted on another


website. Example: src="https://www.w3schools.com/images/img_girl.jpg".

Notes: External images might be under copyright. If you do not get permission


to use it, you may be in violation of copyright laws. In addition, you cannot
control external images; it can suddenly be removed or changed.
2. Relative URL - Links to an image that is hosted within the website. Here,
the URL does not include the domain name. If the URL begins without a slash, it
will be relative to the current page. Example: src="img_girl.jpg". If the URL
begins with a slash, it will be relative to the domain. Example:
src="/images/img_girl.jpg".

Tip: It is almost always best to use relative URLs. They will not break if you
change domain.

The alt Attribute


The required alt attribute for the <img> tag specifies an alternate text for an
image, if the image for some reason cannot be displayed.

<img src="img_girl.jpg" alt="Girl with a jacket">

The lang Attribute


You should always include the lang attribute inside the <html> tag, to declare the
language of the Web page. This is meant to assist search engines and browsers.

HTML Styles
The HTML style attribute is used to add styles to an element, such as color,
font, size, and more.

<tagname style="property:value;">

<p style="color:red;">I am red</p>

The HTML Style Attribute


Setting the style of an HTML element, can be done with the style attribute.

The HTML style attribute has the following syntax:

<tagname style="property:value;">
<body style="background-color:powderblue;">
Text Color
The CSS color property defines the text color for an HTML element:

Example
<h1 style="color:blue;">This is a heading</h1>

Fonts
The CSS font-family property defines the font to be used for an HTML element:

Example
<h1 style="font-family:verdana;">This is a heading</h1>

STYLE SUMMURY
 Use the style attribute for styling HTML elements
 Use background-color for background color
 Use color for text colors
 Use font-family for text fonts
 Use font-size for text sizes
 Use text-align for text alignment

HTML Text Formatting
<b> - Bold text…..<p><b>This text is bold</b></p>
The HTML <b> element defines bold text, without any extra importance.

<strong> - Important text…..The HTML <strong> element defines text with strong


importance.
<strong>This text is important!</strong>

<i> - Italic text


<em> - Emphasized text
<mark> - Marked text
<small> - Smaller text
<del> - Deleted text
<ins> - Inserted text
<sub> - Subscript text
<sup> - Superscript text

You might also like