HTML
MohammedFrom W3schools.com
- All HTML elements can have attributes
- The
href
attribute of<a>
specifies the URL of the page the link goes to - The
src
attribute of<img>
specifies the path to the image to be displayed - The
width
andheight
attributes of<img>
provide size information for images - The
alt
attribute of<img>
provides an alternate text for an image - The
style
attribute is used to add styles to an element, such as color, font, size, and more - The
lang
attribute of the<html>
tag declares the language of the Web page - The
title
attribute defines some extra information about an element
The HTML <pre>
element defines preformatted text.
The text inside a <pre>
element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks:(https://www.w3schools.com/html/html_paragraphs.asp)
Styles in tags:
- 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
Formating Elements:
<b>
- Bold text<strong>
- Important text<i>
- Italic text<em>
- Emphasized text<mark>
- Marked text<small>
- Smaller text<del>
- Deleted text (strike out)<ins>
- Inserted text<sub>
- Subscript text<sup>
- Superscript text
<h1 style="border:2px solid Tomato;">Hello World</h1>
CSS in HTML:]
- Inline - by using the
style
attribute inside HTML elements - Internal - by using a
<style>
element in the<head>
section - External - by using a
<link>
element to link to an external CSS file
Inline:-
Eg: <h1 style="color:blue;">A Blue Heading</h1>
Internal:
Eg: <!DOCTYPE html>
<html>
<head>
<style>
body {backgrxound-color: powderblue;}
h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
External:
Creating External file for css
Use target="_blank" to open the linked document in a new browser window or tab:
<a href="https://www.w3schools.com/" target="_blank">Visit W3Schools!</a>
Use mailto:
inside the href
attribute to create a link that opens the user's email program (to let them send a new email):
<a href="mailto:someone@example.com">Send email</a>
- Use the
<a>
element to define a link - Use the
href
attribute to define the link address - Use the
target
attribute to define where to open the linked document - Use the
<img>
element (inside<a>
) to use an image as a link - Use the
mailto:
scheme inside thehref
attribute to create a link that opens the user's email program
- Use the
id
attribute (id="value") to define bookmarks in a page - Use the
href
attribute (href="#value") to link to the bookmark - Use the HTML
<img>
element to define an image - Use the HTML
src
attribute to define the URL of the image - Use the HTML
alt
attribute to define an alternate text for an image, if it cannot be displayed - Use the HTML
width
andheight
attributes or the CSSwidth
andheight
properties to define the size of the image - Use the CSS
float
property to let the image float to the left or to the right
- Use the HTML
<map>
element to define an image map - Use the HTML
<area>
element to define the clickable areas in the image map - Use the HTML
usemap
attribute of the<img>
element to point to an image map
<img src="workplace.jpg" alt="Workplace" usemap="#workmap">
<map name="workmap">
<area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm">
<area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
<area shape="circle" coords="337,300,44" alt="Coffee" href="coffee.htm">
</map>
The input readonly
attribute specifies that an input field is read-only.
The input disabled
attribute specifies that an input field should be disabled.
The input size
attribute specifies the visible width, in characters, of an input field.
The input maxlength
attribute specifies the maximum number of characters allowed in an input field.
The input list
attribute refers to a <datalist>
element that contains pre-defined options for an <input> element.
The input autocomplete
attribute specifies whether a form or an input field should have autocomplete on or off.