Articles

HTML Field Attributes

Attributes provide additional information about HTML elements, this values can be used in the Custom Fields Attributes field.

  • HTML elements can have attributes
  • Attributes provide additional information about an element
  • Attributes are always specified in the start tag
  • Attributes come in name/value pairs like: name="value"

Optional Attributes

DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

AttributeValueDescriptionDTD
accept MIME_type Specifies the types of files that can be submitted through a file upload (only for type="file") STF
align left
right
top
middle
bottom
Deprecated. Use styles instead.
Specifies the alignment of an image input (only for type="image")
TF
alt text Specifies an alternate text for an image input (only for type="image") STF
disabled disabled Specifies that an input element should be disabled when the page loads STF
maxlength number Specifies the maximum length (in characters) of an input field (for type="text" or type="password") STF
name name Specifies a name for an input element STF
readonly readonly Specifies that an input field should be read-only (for type="text" or type="password") STF
size number Specifies the width of an input field STF
cols number Specifies the visible width of a text-area STF
rows number Specifies the visible number of rows in a text-area STF


Standard Attributes

The <input> tag supports the following standard attributes:

AttributeValueDescriptionDTD
accesskey character Specifies a keyboard shortcut to access an element STF
class classname Specifies a classname for an element STF
dir rtl
ltr
Specifies the text direction for the content in an element STF
id id Specifies a unique id for an element STF
lang language_code Specifies a language code for the content in an element STF
style style_definition Specifies an inline style for an element STF
tabindex number Specifies the tab order of an element STF
title text Specifies extra information about an element STF
xml:lang language_code Specifies a language code for the content in an element, in XHTML documents STF

Event Attributes

The <input> tag supports the following event attributes:

AttributeValueDescriptionDTD
onblur script Script to be run when an element loses focus STF
onchange script Script to be run when an element change STF
onclick script Script to be run on a mouse click STF
ondblclick script Script to be run on a mouse double-click STF
onfocus script Script to be run when an element gets focus STF
onmousedown script Script to be run when mouse button is pressed STF
onmousemove script Script to be run when mouse pointer moves STF
onmouseout script Script to be run when mouse pointer moves out of anelement STF
onmouseover script Script to be run when mouse pointer moves over anelement STF
onmouseup script Script to be run when mouse button is released STF
onkeydown script Script to be run when a key is pressed STF
onkeypress script Script to be run when a key is pressed and released STF
onkeyup script Script to be run when a key is released STF
onselect script Script to be run when an element is selected STF


CSS Reference

The links in the "Property" column point to syntax, examples, browser support, and other useful information about each property.

The "CSS" column indicates in which CSS version the property is defined (CSS1 or CSS2).

Background Properties

Property Description Values CSS
background Sets all the background properties in one declaration background-color
background-image
background-repeat
background-attachment
background-position

inherit
1
background-attachment Sets whether a background image is fixed or scrolls with the rest of the page scroll
fixed
inherit
1
background-color Sets the background color of an element color-rgb
color-hex
color-name
transparent
inherit
1
background-image Sets the background image for an element url(URL)
none
inherit
1
background-position Sets the starting position of a background image top left
top center
top right
center left
center center
center right
bottom left
bottom center
bottom right
x% y%
xpos ypos
inherit
1
background-repeat Sets how a background image will be repeated repeat
repeat-x
repeat-y
no-repeat
inherit
1

Border and Outline Properties

Property Description Values CSS
border Sets all the border properties in one declaration border-width
border-style
border-color
inherit
1
border-bottom Sets all the bottom border properties in one declaration border-bottom-width
border-bottom-style
border-bottom-color
inherit
1
border-bottom-color Sets the color of the bottom border border-color
inherit
2
border-bottom-style Sets the style of the bottom border border-style
inherit
2
border-bottom-width Sets the width of the bottom border border-width
inherit
1
border-color Sets the color of the four borders color_name
hex_number
rgb_number
transparent
inherit
1
border-left Sets all the left border properties in one declaration border-left-width
border-left-style
border-left-color
inherit
1
border-left-color Sets the color of the left border border-color
inherit
2
border-left-style Sets the style of the left border border-style
inherit
2
border-left-width Sets the width of the left border border-width
inherit
1
border-right Sets all the right border properties in one declaration border-right-width
border-right-style
border-right-color
inherit
1
border-right-color Sets the color of the right border border-color
inherit
2
border-right-style Sets the style of the right border border-style
inherit
2
border-right-width Sets the width of the right border border-width
inherit
1
border-style Sets the style of the four borders none
hidden
dotted
dashed
solid
double
groove
ridge
inset
outset
inherit
1
border-top Sets all the top border properties in one declaration border-top-width
border-top-style
border-top-color
inherit
1
border-top-color Sets the color of the top border border-color
inherit
2
border-top-style Sets the style of the top border border-style
inherit
2
border-top-width Sets the width of the top border border-width
inherit
1
border-width Sets the width of the four borders thin
medium
thick
length
inherit
1
outline Sets all the outline properties in one declaration outline-color
outline-style
outline-width
inherit
2
outline-color Sets the color of an outline color-rgb
color-hex
color-name
invert
inherit
2
outline-style Sets the style of an outline none
dotted
dashed
solid
double
groove
ridge
inset
outset
inherit
2
outline-width Sets the width of an outline thin
medium
thick
length
inherit
2

Dimension Properties

Property Description Values CSS
height Sets the height of an element auto
length
%
inherit
1
max-height Sets the maximum height of an element none
length
%
inherit
2
max-width Sets the maximum width of an element none
length
%
inherit
2
min-height Sets the minimum height of an element length
%
inherit
2
min-width Sets the minimum width of an element length
%
inherit
2
width Sets the width of an element auto
length
%
inherit
1

Font Properties

Property Description Values IE F N CSS
font
Sets all the font properties in one declaration font-style
font-variant
font-weight
font-size/line-height
font-family
caption
icon
menu
message-box
small-caption
status-bar
4 1 4 1
font-family
Sets the font family for an element family-name
generic-family
3 1 4 1
font-size
Sets the size of a font xx-small
x-small
small
medium
large
x-large
xx-large
smaller
larger
length
%
3 1 4 1
font-style
Sets the style of the font normal
italic
oblique
4 1 4 1
font-variant
Displays text in a small-caps font or in a normal font normal
small-caps
4 1 6 1
font-weight
Sets the weight of a font normal
bold
bolder
lighter
100
200
300
400
500
600
700
800
900
4 1 4 1

Generated Content Properties

Property Description Values CSS
content Used with the :before and :after pseudo-elements, to insert generated content normal
none
content specifications
inherit
2
counter-increment Increments one or more counters none
id number
inherit
2
counter-reset Creates or resets one or more counters none
id number
inherit
2
quotes Sets the type of quotation marks for embedded quotations none
string string
inherit
2

List Properties

Property Description Values CSS
list-style Sets all the properties for a list in one declaration list-style-type
list-style-position
list-style-image
inherit
1
list-style-image Specifies an image as the list-item marker URL
none
inherit
1
list-style-position Specifies where to place the list-item marker inside
outside
inherit
1
list-style-type Specifies the type of list-item marker none
disc
circle
square
decimal
decimal-leading-zero
armenian
georgian
lower-alpha
upper-alpha
lower-greek
lower-latin
upper-latin
lower-roman
upper-roman
inherit
1

Margin Properties

Property Description Values CSS
margin Sets all the margin properties in one declaration auto
length
%
inherit
1
margin-bottom Sets the bottom margin of an element auto
length
%
inherit
1
margin-left Sets the left margin of an element auto
length
%
inherit
1
margin-right Sets the right margin of an element auto
length
%
inherit
1
margin-top Sets the top margin of an element auto
length
%
inherit
1

Padding Properties

Property Description Values CSS
padding Sets all the padding properties in one declaration length
%
inherit
1
padding-bottom Sets the bottom padding of an element length
%
inherit
1
padding-left Sets the left padding of an element length
%
inherit
1
padding-right Sets the right padding of an element length
%
inherit
1
padding-top Sets the top padding of an element length
%
inherit
1

Positioning Properties

Property Description Values CSS
bottom Sets the bottom margin edge for a positioned box auto
length
%
inherit
2
clear Specifies which sides of an element where other floating elements are not allowed none
left
right
both
inherit
1
clip Clips an absolutely positioned element shape
auto
inherit
2
cursor Specifies the type of cursor to be displayed URL
auto
crosshair
default
e-resize
help
move
n-resize
ne-resize
nw-resize
pointer
progress
s-resize
se-resize
sw-resize
text
w-resize
wait
inherit
2
display Specifies the type of box an element should generate block
inline
inline-block
inline-table
list-item
run-in
table
table-caption
table-cell
table-column
table-column-group
table-footer-group
table-header-group
table-row
table-row-group
none
inherit
1
float Specifies whether or not a box should float left
right
none
inherit
1
left Sets the left margin edge for a positioned box auto
length
%
inherit
2
overflow
Specifies what happens if content overflows an element's box auto
hidden
scroll
visible
inherit
2
position Specifies the type of positioning for an element absolute
fixed
relative
static
inherit
2
right Sets the right margin edge for a positioned box auto
length
%
inherit
2
top Sets the top margin edge for a positioned box auto
length
%
inherit
2
visibility Specifies whether or not an element is visible visible
hidden
collapse
inherit
2
z-index Sets the stack order of an element number
auto
inherit
2

Print Properties

Property Description Values CSS
orphans Sets the minimum number of lines that must be left at the bottom of a page when a page break occurs inside an element number
inherit
2
page-break-after Sets the page-breaking behavior after an element auto
always
avoid
left
right
inherit
2
page-break-before Sets the page-breaking behavior before an element auto
always
avoid
left
right
inherit
2
page-break-inside Sets the page-breaking behavior inside an element auto
avoid
inherit
2
widows Sets the minimum number of lines that must be left at the top of a page when a page break occurs inside an element number
inherit
2

Table Properties

Property Description Values CSS
border-collapse Specifies whether or not table borders should be collapsed collapse
separate
inherit
2
border-spacing Specifies the distance between the borders of adjacent cells length
inherit
2
caption-side Specifies the placement of a table caption top
bottom
inherit
2
empty-cells Specifies whether or not to display borders and background on empty cells in a table show
hide
inherit
2
table-layout Sets the layout algorithm to be used for a table auto
fixed
inherit
2

Text Properties

Property Description Values IE F N CSS
color Sets the color of a text color 3 1 4 1
direction Sets the text direction ltr
rtl
6 1 6 2
line-height Sets the distance between lines normal
number
length
%
4 1 4 1
letter-spacing Increase or decrease the space between characters normal
length
4 1 6 1
text-align Aligns the text in an element left
right
center
justify
4 1 4 1
text-decoration Adds decoration to text none
underline
overline
line-through
blink
4 1 4 1
text-indent Indents the first line of text in an element length
%
4 1 4 1
text-shadow
none
color
length




text-transform Controls the letters in an element none
capitalize
uppercase
lowercase
4 1 4 1
unicode-bidi
normal
embed
bidi-override
5

2
vertical-align Sets the vertical alignment of an element baseline
sub
super
top
text-top
middle
bottom
text-bottom
length
%
4 1 4 1
white-space Sets how white space inside an element is handled normal
pre
nowrap
5 1 4 1
word-spacing Increase or decrease the space between words normal
length
6 1 6 1

Pseudo-classes

Pseudo-class Purpose IE F N CSS
:active Adds special style to an activated element 4 1 8 1
:focus Adds special style to an element while the element has focus - 1.5 8 2
:hover Adds special style to an element when you mouse over it 4 1 7 1
:link Adds special style to an unvisited link 3 1 4 1
:visited Adds special style to a visited link 3 1 4 1
:first-child Adds special style to an element that is the first child of some other element - 1 7 2
:lang Allows the author to specify a language to use in a specified element - 1 8 2



More information on W3Schools.com

Newsletter

captcha

Connect with us

We're on Social Networks. Follow us & get in touch.
You are here: Start page