HTML
HTML
INTRODUCTION
SYNTAX:
<TAG>Content</TAG> //Always close tags after entering the content. Closing tags have the same
name but with “ / ” symbol at the start.
BASIC TAGS:
<!DOCTYPE html> //This tag implies that this is a html file
Code:
HTML
ATTRIBUTES
SYNTAX:
<Tag AttributeName = “Value”>Content</Tag> //Make sure to always use Quotation marks for
Values.
Attributes are used to provide and modify additional information about content in certain tags, for
example:
Changing the color of text in a paragraph using <p style=”color:red”><\p> (style attribute)
EMPTY TAGS
SYNTAX:
<Tag> //Empty tags don’t need closing tags in order to function
EXAMPLES:
<hr> //this tag is used to draw ending lines or separators
HTML
<br> //this tag is used to go to the next line while writing a paragraph
STYLES
The style attribute can be used to add styles to content in a tag, such as color(Name, RGB, SRGB),
font, size, and more
//This is a CSS attribute and uses CSS values so styles need to be separated by “;” within the
attribute.
EXAMPLES:
FINAL:
CODE:
HTML
FORMATTING ELEMENTS
TAGS:
<b></b> //tags used to make text bold
<abbr title=””></abbr> //tags used to define abbreviations. These mostly include the title attribute
to define these abbreviations.
COMMENTS:
<!—content-->
These are used to write information related to the code but don’t affect the webpage.
HYPERLINKS
SYNTAX:
<a href=”https://www.youtube.com/watch?v=dQw4w9WgXcQ”>Click/Tap me</a>
These are used to direct the viewer to a different page, image and websites. URLS can be both
Absolute (Web links) and Relative (local address)
EXAMPLE:
CLICK/TAP ME
ATTRIBUTE:
You can use the “target” attribute to provide additional information on how these links will behave
_self - Default. Opens the document in the same window/tab as it was clicked
_blank - Opens the document in a new window or tab
_parent - Opens the document in the parent frame
_top - Opens the document in the full body of the window
HTML
IMAGES
SYNTAX:
<img src=”image source” alt=”image name”> //Empty tag so it does not require an ending tag
ATTRIBUTES:
src – Image source
style values:
EXAMPLE:
CODE:
HTML
FAVICON
This is the icon that is displayed on the tab beside the title
SYNTAX:
<link rel="icon" type="image/x-icon" href="/images/favicon.ico"> //This should be within <head> tag
EXAMPLE:
To put subhankar.jpg as our favicon
Resulting in:
HTML
TABLES:
Create a table of data
SYNTAX:
<table> //initiate table
<th></th>
<th></th>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
LISTS
Create a list of data
SYNTAX:
An unordered HTML list:
<ol>
<li> </li>
<li> </li>
<li> </li>
</ol>
HTML
EXAMPLES:
DIV
Creates a new block with its own properties
SYNTAX:
<div></div>
EXPLANATION:
HTML
In the above website, each one of the blue boxes is a DIV. The website needs to be a collection of
DIVs for ease of styling and adding more elements.