HTML Css Ref
HTML Css Ref
HTML Css Ref
Tag Description
<title> text </title> title shown on page tab
<meta attribute="value" ... /> page metadata
<link href="url" type="text/css" rel="stylesheet" /> links to a CSS style sheet
<script src="url"></script> link to JavaScript code
comment (can appear in head or
<!-- comments -->
body)
1
Tags Used in the <body> Section (Continued)
2
HTML Input Tags
Note that input tags are inline tags.
3
CSS
For the following property and value tables, anything emphasized represents values that should be replaced with
specific units (e.g., length should be replaced with a px, pt, or em for many properties, and color should be
replaced with a valid color value such as a hex or rgb code).
A use of | refers to separation of possible values (where you cannot provide two of these possible values for one
property) and [value value value] refers to a grouping of possible values that can optionally be used together
(e.g., [h-shadow v-shadow blur spread color] for box-shadow).
Selector Types
Background Styles
Property Values
background-attachment scroll | fixed
background-color color | transparent
background-image url | none
background-origin border-box | padding-box | content-box
background-position top left | top center | top right |
center left | center center | center right |
bottom left | bottom center | bottom right
[x-% y-% ] | [x-pos y-pos ]
background-size length | % | auto | cover | contain
background-repeat repeat | repeat-x | repeat-y | no-repeat
background-attachment scroll | fixed
4
Border Styles
Note: Replace ’*’ with any side of the border (top, right, left, bottom) for the desired effect.
Example style: ’border: 2px solid red’ applies a solid red border with a width of 2px to all four sides of
the element, while ’border-left: 2px solid red’ only applies that border to the left border’.
Property Values
border, border-* (shorthand) border-width, border-*-width
border-style, border-*-style
border-color, border-*-color
border-width, border-*-width thin | medium | thick | length
border-style, border-*-style none | hidden | dotted | dashed | solid |
double | groove | rigid | inset | outset
border-color, border-*-color color
box-shadow none | inset | [h-shadow v-shadow blur spread color ]
border-radius length
Property Values
font-style normal | italic | oblique | inherit
font-family fontname
font-size length | %
font-weight normal | bold | inherit
text-align left | right | center | justify
text-decoration none | [underline overline line-through blink]
text-shadow none | [color length ]
letter-spacing, word-spacing normal | length | %
text-indent length | %
text-transform none | capitalize | uppercase | lowercase
list-style-type none | asterisks | box | check | diamond | disc | hyphen |
square | decimal | lower-roman | upper-roman |
lower-alpha | upper-alpha | lower-greek | upper-greek |
lower-latin | upper-latin | footnotes
list-style-image none | url
Color Values
Value Description
colorname standard name of color, such as red, blue, purple, etc.
rgb(redvalue, greenvalue,
Example: red = rgb(255, 0, 0) or red = rgb(100%, 0, 0)
bluevalue)
#RRGGBB Example: red = #FF0000
5
Box Model
Property Values
float left | right | none
height, width auto | length | %
min-height, max-height none | length | %
min-width, max-width
margin, margin-* auto | length | %
padding, padding-* length | %
display none | inline | block | inline-block | flex |
list-item | compact | table | inline-table
overflow, overflow-x, overflow-y visible | hidden | scroll |
auto | no-display | no-content
clear left | right | both | none
Flex Box
(on next page)
6
Property Values Element Type Description
display flex Flex Container Sets all children to become ’flex-items’
justify-content Flex container Indicates how to position the flex-items
in the parent container
flex-start
flex-end
center
space-around
space-between
flex-direction row | row-reverse | Flex container Indicates if the container flows horizon-
column | column-reverse tally (row) or vertically (column)
align-items stretch (default) Flex container Indicates how to space the items inside
the container along the cross axis
flex-start
flex-end
center
baseline
flex-basis auto (default) | length | Both Specifies the default size of an element
% before the extra space is distributed
among the flex-items
order number Flex item Specifies the order in which the ele-
ment appears in the flex container (by
default, flex items are laid out in the
source order)
align-self flex-end | flex-start | Flex item Indicates where to place this specific
center | baseline | item along the cross axis
stretch (default)
7