css表格表单

zhongta / 2024-10-09 / 原文

1.项目符号样式list-style-type
无序列表:none disc circle square(无,黑点,圆圈,方格)
有序列表:decimal decimal-leading-zero,lower-alpha,upper-alpha,lower_roman,upper-roman
<!DOCTYPE html>
<html>
	<head>
		<title>List Style Type</title>
		<style type="text/css">
			ol {
				list-style-type: lower-roman;}
		</style>
	</head>
	<body>
		<h1>The Complete Poems</h1>
		<h2>Emily Dickinson</h2>
		<ol>
			<li>Life</li>
			<li>Nature</li>
			<li>Love</li>
			<li>Time and Eternity</li>
			<li>The Single Hound</li>
		</ol>
	</body>
</html>
2.项目图像
list-style-iamge
<!DOCTYPE html>
<html>
	<head>
		<title>List Style Image</title>
		<style type="text/css">
			ul {
				list-style-image: url("images/star.png");}
			li {
				margin: 10px 0px 0px 0px;}
		</style>
	</head>
	<body>
		<h1>Index of Translated Poems</h1>
		<h2>Arthur Rimbaud</h2>
		<ul>
			<li>Ophelia</li>
			<li>To Music</li>
			<li>A Dream for Winter</li>
			<li>Vowels</li>
			<li>The Drunken Boat</li>
		</ul>
	</body>
</html>
3.标记的定位
list-style-position
outside:标记位于文本块的左侧
inside:标记位于文本块的内部,并缩进文本块。
<!DOCTYPE html>
<html>
	<head>
		<title>List Style Position</title>
		<style type="text/css">
			ul {
				width: 250px;}
			li {
				margin: 10px;}
			ul.illuminations {
				list-style-position: outside;}
			ul.season {
				list-style-position: inside;}
		</style>
	</head>
	<body>
		<h3>Illuminations</h3>
		<ul class="illuminations">
			<li>That idol, black eyes and yellow mop, without parents or court ...</li>
			<li>Gracious son of Pan! Around your forehead crowned with flowerets ...</li>
			<li>When the world is reduced to a single dark wood for our four ...</li>
		</ul>
		<h3>A Season in Hell</h3>
		<ul class="season">
			<li>Once, if my memory serves me well, my life was a banquet ...</li>
			<li>Hadn't I once a youth that was lovely, heroic, fabulous ...</li>
			<li>Autumn already! - But why regret the everlasting sun if we are ...</li>
		</ul>
	</body>
</html>
4.list-style略写,快捷方式。
			ul {
				list-style: inside circle;
				width: 300px;}
			li {
				margin: 10px 0px 0px 0px;}
5.表格属性
width:宽度
padding:每个单元格边框与其内容之间的空隙
text-transform将表格标题中的内容转换为大写。
letter-spacing,font-size字体间隔,字体大小
border-top.border-bottom表格边框
text-align文本对齐
background-color背景色
:hover悬停
<!DOCTYPE>
<html>
	<head>
		<title>Table Properties</title>
		<style type="text/css">
			body {
				font-family: Arial, Verdana, sans-serif;
				color: #111111;}
			table {
				width: 600px;}
			th, td {
				padding: 7px 10px 10px 10px;}
			th {
				text-transform: uppercase;
				letter-spacing: 0.1em;
				font-size: 90%;
				border-bottom: 2px solid #111111;
				border-top: 1px solid #999;
				text-align: left;}
			tr.even {
				background-color: #efefef;}
			tr:hover {
				background-color: #c3e6e5;}
			.money {
				text-align: right;}
		</style>
	</head>
	<body>
		<h1>First Edition Auctions</h1>
		<table>
			<tr>
				<th>Author</th>
				<th>Title</th>
				<th class="money">Reserve Price</th>
				<th class="money">Current Bid</th>
			</tr>
			<tr>
				<td>E.E. Cummings</td>
				<td>Tulips & Chimneys</td>
				<td class="money">$2,000.00</td>
				<td class="money">$2,642.50</td>
			</tr>
			<tr class="even">
				<td>Charles d'Orleans</td>
				<td>Poemes</td>
				<td class="money"></td>
				<td class="money">$5,866.00</td>
			</tr>
			<tr>
				<td>T.S. Eliot</td>
				<td>Poems 1909 - 1925</td>
				<td class="money">$1,250.00</td>
				<td class="money">$8,499.35</td>
			</tr>
			<tr class="even">
				<td>Sylvia Plath</td>
				<td>The Colossus</td>
				<td class="money"></td>
				<td class="money">$1031.72</td>
			</tr>
		</table>
	</body>
</html>
6.空单元格的边框empty-cells
(1)show显示(2)hide隐藏(3)inherit继承
<!DOCTYPE html>
<html>
	<head>
		<title>Empty Cells</title>
		<style type="text/css">
			td {
				border: 1px solid #0088dd;
				padding: 15px;}
			table.one {
				empty-cells: show;}
			table.two {
				empty-cells: hide;}
		</style>
	</head>
	<body>
		<table class="one">
			<tr>
				<td>1</td>
				<td>2</td>
			</tr>
			<tr>
				<td>3</td>
				<td></td>
			</tr>
		</table>
		<table class="two">
			<tr>
				<td>1</td>
				<td>2</td>
			</tr>
			<tr>
				<td>3</td>
				<td></td>
			</tr>
		</table>
	</body>
</html>
7.单元格之间的空隙
border-spacing 产生空隙
border-collapse 单元格会挤压到一起
<!DOCTYPE html>
<html>
	<head>
		<title>Gaps Between Cells</title>
		<style type="text/css">
			td {
				background-color: #0088dd;
				padding: 15px;
				border: 2px solid #000000;}
			table.one {
				border-spacing: 5px 15px;}
			table.two {
				border-collapse: collapse;}
		</style>
	</head>
	<body>
		<table class="one">
			<tr>
				<td>1</td>
				<td>2</td>
			</tr>
			<tr>
				<td>3</td>
				<td>4</td>
			</tr>
		</table>
		<table class="two">
			<tr>
				<td>1</td>
				<td>2</td>
			</tr>
			<tr>
				<td>3</td>
				<td>4</td>
			</tr>
		</table>
	</body>
</html>