Html and CSS Cheatsheet

Html Elements

Html elements are the buliding block of an html document, they are used to structure html documents using opening and closing tags

Elements properties
<h1> This element is used to create headings in an HTML document
<p> This element is used to create a paragraph in an HTML document
<a> This element is used to create a hyperlink in an HTML document
<img> This element is used to embed an image in an HTML document
<ul> This element is used to create an unordered list in an HTML document
<ol> This element is used to create an Ordered list in an HTML document
<li> This element is used to create a list item in an HTML document
<footer> This element is used to create a footer in an HTML document

Html Attributes

Html attributes are used to provide additional information about an element in an HTML document

Attributes Properties
href This attribute is used to specify the URL of the page the link goes to
src This attribute is used to specify the URL of the image
alt This attribute is used to specify an alternate text for an image
width This attribute is used to specify the width of an image
height This attribute is used to specify the height of an image
style This attribute is used to specify the style of an element
title This attribute is used to specify the title of an element as a tooltip
class This attribute is used to specify the class of an element
id This attribute is used to specify the id of an element using the # value
name This attribute is used to specify the name of an element
value This attribute is used to specify the value of an element
type This attribute is used to specify the type of an element
placeholder This attribute is used to specify a hint that describes the expected value of an input field when empty

CSS

The Cascading Style sheet also known as the CSS is a programming language used in styling or used to describe an html document

Elements Properties
color This property is used to set the color of the text
background-color This property is used to set the background color of an element
font-size This property is used to set the size of the text
font-family This property is used to set the font style of a text
text-align This property is used to align the text anywhere on the document
display This property is used to set the display of an element
Position This property is used to postion elements in the html document
margin This property is used to set the margin of an element
padding This property is used to set the padding of an element
z-index This property is used to set the stack order of an element, usually used when the Postion is set to fixed
:link This property is used to set the style of a link that has not been visited
:visited This property is used to set the style of a link that has been visited
:hover This property is used to change the style of an element when the mouse hovers over it
:active This property is used to change the style of an element when it is being clicked
border-radius This property is used to set the radius of the border of an element
box-shadow This property is used to set the shadow of the border of an element
vertical-align This property is used to set the vertical alignment of an inline or table-cell element using the values like "baseline, top, middle bottom, sub, super and others
border This property is used to set the border of an elementset the vertical alignment of an inline or table-cell element.

CSS selectors

Css selectors are used to select the content you want to style in an html document

Selectors Properties
Element Selector This selector matches elements using the Element value
Class Selector This selector matches elements using the class value
attribute selector This selector matches elements using the attribute value
ID selector This selector matches elements using the ID or # value
Universal Selector This selector matches all elements in an html document
Descendant Selector This selector matches elements that are descendants of a specified element