HTML/CSS/Table Style/table caption
Содержание
- 1 Caption align to the right
- 2 caption background-color: red;
- 3 caption border-color: #666666;
- 4 caption border-style: solid;
- 5 caption border-width: 1px;
- 6 caption color: yellow;
- 7 caption font-weight: bold;
- 8 caption font-weight: bold; / color: yellow;
- 9 caption tag summarizes the table"s contents (this helps the visually impaired)
- 10 caption text-align: left;
- 11 caption text-align: right
- 12 Set style for table caption
- 13 Table caption tag
- 14 Table with caption and table header
- 15 Table with caption, header, footer and table body
Caption align to the right
<source lang="html4strict">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html>
<head> <title> My favorite records </title> <style rel="stylesheet" type="text/css">
body {
margin: 0;
} table {
border: thin solid black; table-layout: auto;
} th, tfoot td {
border: thin solid black; text-align: center; font-weight: bold;
} tbody td {
font-size: 120%;
} caption {
font-size: 90%; text-align: right;
} td, th, caption {
padding: 5px;
}
</style> </head> <body>
album | artist | released |
---|---|---|
R | T | 1 |
B | V | 1 |
Q | Q/td> | 1 |
M | T | 1 |
album | artist | released |
</body>
</html>
</source>
<source lang="html4strict">
<html>
<head><title>Tables</title>
<style type="text/css">
td {
text-align: center; font-weight: bold;
} table {
background-color: blue; color: white;
} caption {
background-color: red; color: yellow; font-weight: bold;
} th {
background-color: gold; color: navy
} td.center {
background-color: white; color: black;
} </style></head> <body>
Col 1 | Col 2 | Col 3 |
---|---|---|
X | X | X |
X | X | X |
X | X | X |
</body> </html>
</source>
<source lang="html4strict">
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head>
<title>CSS Example</title> <style rel="stylesheet" type="text/css">
caption {
font-weight: bold; text-align: left; border-style: solid; border-width: 1px; border-color: #666666;
}
</style> </head> <body>
Property | Purpose |
---|---|
font-family | Specifies the font used. |
font-size | Specifies the size of the font used. |
font-style | Specifies whether the font should be normal, italic, or oblique. |
font-weight | Specifies whether the font should be normal, bold, bolder, or lighter. |
</body> </html>
</source>
<source lang="html4strict">
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head>
<title>CSS Example</title> <style rel="stylesheet" type="text/css">
caption {
font-weight: bold; text-align: left; border-style: solid; border-width: 1px; border-color: #666666;
}
</style> </head> <body>
Property | Purpose |
---|---|
font-family | Specifies the font used. |
font-size | Specifies the size of the font used. |
font-style | Specifies whether the font should be normal, italic, or oblique. |
font-weight | Specifies whether the font should be normal, bold, bolder, or lighter. |
</body> </html>
</source>
<source lang="html4strict">
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head>
<title>CSS Example</title> <style rel="stylesheet" type="text/css">
caption {
font-weight: bold; text-align: left; border-style: solid; border-width: 1px; border-color: #666666;
}
</style> </head> <body>
Property | Purpose |
---|---|
font-family | Specifies the font used. |
font-size | Specifies the size of the font used. |
font-style | Specifies whether the font should be normal, italic, or oblique. |
font-weight | Specifies whether the font should be normal, bold, bolder, or lighter. |
</body> </html>
</source>
<source lang="html4strict">
<html> <head><title>Tables</title> <style type="text/css"> td {
text-align: center; font-weight: bold;
} table {
background-color: blue; color: white;
} caption {
background-color: red; color: yellow; font-weight: bold;
} th {
background-color: gold; color: navy
} td.center {
background-color: white; color: black;
} </style></head> <body>
Col 1 | Col 2 | Col 3 |
---|---|---|
X | X | X |
X | X | X |
X | X | X |
</body> </html>
</source>
<source lang="html4strict">
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head>
<title>CSS Example</title> <style rel="stylesheet" type="text/css">
caption {
font-weight: bold; text-align: left; border-style: solid; border-width: 1px; border-color: #666666;
}
</style> </head> <body>
Property | Purpose |
---|---|
font-family | Specifies the font used. |
font-size | Specifies the size of the font used. |
font-style | Specifies whether the font should be normal, italic, or oblique. |
font-weight | Specifies whether the font should be normal, bold, bolder, or lighter. |
</body> </html>
</source>
<source lang="html4strict">
<html>
<head><title>Tables</title>
<style type="text/css">
td {
text-align: center; font-weight: bold;
} table {
background-color: blue; color: white;
} caption {
background-color: red; color: yellow; font-weight: bold;
} th {
background-color: gold; color: navy
} td.center {
background-color: white; color: black;
} </style></head> <body>
Col 1 | Col 2 | Col 3 |
---|---|---|
X | X | X |
X | X | X |
X | X | X |
</body> </html>
</source>
<source lang="html4strict">
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head> <title>A simple XHTML table</title> </head> <body>
Apple | $0.25 |
Orange | $0.50 |
Banana | $1.00 |
Pineapple | $2.00 |
</body>
</html>
</source>
<source lang="html4strict">
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head>
<title>CSS Example</title> <style rel="stylesheet" type="text/css">
caption {
font-weight: bold; text-align: left; border-style: solid; border-width: 1px; border-color: #666666;
}
</style> </head> <body>
Property | Purpose |
---|---|
font-family | Specifies the font used. |
font-size | Specifies the size of the font used. |
font-style | Specifies whether the font should be normal, italic, or oblique. |
font-weight | Specifies whether the font should be normal, bold, bolder, or lighter. |
</body> </html>
</source>
<source lang="html4strict">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html>
<head> <title> My favorite records </title> <style rel="stylesheet" type="text/css">
table {
width: 100%; border: thin solid black;
} th, tfoot td {
border: thin solid black; text-align: center; font-weight: bold;
} tbody td {
font-size: 120%;
} caption {
font-size: 90%; text-align: right;
} td, th, caption {
padding: 5px;
}
</style> </head> <body>
a | a | r |
---|---|---|
R | T | 1 |
a | a | r |
</body>
</html>
</source>
<source lang="html4strict">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <style type="text/css"> table caption {
font: 1.5em Georgia, "Times New Roman", Times, serif; padding: 1em;
} </style> </head> <body>
</body> </html>
</source>
<source lang="html4strict">
<?xml version"1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <title>A Basic Table with Caption</title> </head> <body>
Pizza Type | Small | Medium | Large |
Thin Crust | 3.99 | 4.99 | 6.99 |
Deep Dish | 4.99 | 6.99 | 8.99 |
Stuffed Crust | 5.99 | 7.99 | 9.99 |
</body>
</html>
</source>
<source lang="html4strict">
<html>
<head><title>Tables</title></head>
<body>
Col 1 | Col 2 | Col 3 |
---|---|---|
X | X | X |
X | X | X |
X | X | X |
</body> </html>
</source>
<source lang="html4strict">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title></title>
</head> <body>
Song Name | Time | Artist | Album | Play Count |
---|---|---|---|---|
Music | ||||
A | 4:26 | S | D | 4 |
</body> </html>
</source>