四个现实中的商品样例,帮助你理解如何使用css【前端CSS入门样例】

实现商品列表
html 复制代码
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>商品列表图片</title>
		<style>
			.row > img {
				width: 15%;
			}
		</style>
	</head>
	<body>
		<div class="row">
			<img src="image/00001.jpg" alt="">
			<img src="image/00002.jpg" alt="">
			<img src="image/00003.jpg" alt="">
			<img src="image/00004.jpg" alt="">
			<img src="image/00005.jpg" alt="">
			<img src="image/00006.jpg" alt="">
		</div>
		<div class="row">
			<img src="image/00007.jpg" alt="">
			<img src="image/00008.jpg" alt="">
			<img src="image/00009.jpg" alt="">
			<img src="image/00010.jpg" alt="">
			<img src="image/00011.jpg" alt="">
			<img src="image/00012.jpg" alt="">
		</div>
	</body>
</html>
 
 
实现排行榜效果
html 复制代码
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>排行榜</title>
		<style>
			#rank-list td {
				font-size: 1.1em;
				padding-top: 3px;
				padding-bottom: 3px;
			}
			
			a {
				text-decoration: none;
				color: blue;
			}
			
			.num > span{
				color: darkgray;
			}
			
			.boil {
				background-color: red;
				color: white;
				border-radius: 5px;
				font-size: 0.85em;
				padding: 1px 2px 1px 2px;
			}
			
			.hot {
				background-color: coral;
				color: white;
				border-radius: 5px;
				font-size: 0.85em;
				padding: 1px 2px 1px 2px;
			}
			
			.new {
				background-color: orange;
				color: white;
				border-radius: 5px;
				font-size: 0.85em;
				padding: 1px 2px 1px 2px;
			}
			
			
			
		</style>
	</head>
	<body>
		<div class="container">
			<table id="rank-list">
				<tr>
					<td><span><img src="image/top-one.png" alt="" width="20px"></span></td>
					<td><a href="#">中国空间站第三棒全力开跑</a></td>
				</tr>
				<tr>
					<td class="num"><span style="color: red;">1</span></td>
					<td><a href="#">#2022高考作文来了# <span class="boil">沸</span></a></td>
				</tr>
				<tr>
					<td class="num"><span style="color: coral;">2</span></td>
					<td><a href="#">深圳回应"50辆宾利堵车位"纠纷 <span class="hot">热</span></a></td>
				</tr>
				<tr>
					<td class="num"><span style="color: orange;">3</span></td>
					<td><a href="#">回头看高考青春永不老 <span class="hot">热</span></a></td>
				</tr>
				<tr>
					<td class="num"><span>4</span></td>
					<td><a href="#">不出意外今年高考又出现了这些意外</a></td>
				</tr>
				<tr>
					<td class="num"><span>5</span></td>
					<td><a href="#">考生忘带准考证家长又送错考场  <span class="new">新</span></a></td>
				</tr>
				<tr>
					<td class="num"><span>6</span></td>
					<td><a href="#">苹果用3分钟正式宣战新行业</a></td>
				</tr>
				<tr>
					<td class="num"><span>7</span></td>
					<td><a href="#">5名考生"组团"跑错考点交警转送  <span class="new">新</span></a></td>
				</tr>
				<tr>
					<td class="num"><span>8</span></td>
					<td><a href="#">俄罗斯卢布如何做到"惊天逆转"  <span class="new">新</span></a></td>
				</tr>
				<tr>
					<td class="num"><span>9</span></td>
					<td><a href="#">美国最大水库因干涸发现多具藏尸</td>
				</tr>
				<tr>
					<td class="num"><span>10</span></td>
					<td><a href="#">60秒看各地家长花式送考</td>
				</tr>

			</table>
		</div>
	</body>
</html>
实现棋盘效果
html 复制代码
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>作业2591实现棋盘效果</title>
		<style>
			.container {
				width: 600px;
				height: 600px;				
				border: 5px solid black;
				margin: auto;
				display: flex;
			}
			
			.black {
				background-color: black;
				width: 200px;
				height: 200px;
			}
			.white {
				background-color: white;
				width: 200px;
				height: 200px;
			}
		</style>
	</head>
	<body>
		<div class="container">
			<div>
				<div class="black"></div>
				<div class="white"></div>
				<div class="black"></div>
			</div>
			<div>
				<div class="white"></div>
				<div class="black"></div>
				<div class="white"></div>
			</div>
			<div>
				<div class="black"></div>
				<div class="white"></div>
				<div class="black"></div>
			</div>
		</div>
	</body>
</html>
电话按键
html 复制代码
    <table width="400px" border="1px" cellspacing=0>
        <tr class="one">
            <td>1</td>
            <td>2</td>
            <td>3</td>
        </tr>
        <tr class="two">
            <td>4</td>
            <td>5</td>
            <td>6</td>
        </tr>
        <tr class="three">
            <td>7</td>
            <td>8</td>
            <td>9</td>
        </tr>
    </table>


    <style>
        table, td {
            text-align: center;
        }


        .one {
            color:red;
            text-decoration: underline;
        }


        .two {
            color: green;
            text-decoration: line-through;
        }


        .three {
            color: blue;
            font-weight: 900;
        }
      </style>
 
 
相关推荐
滚雪球~23 分钟前
npm error code ETIMEDOUT
前端·npm·node.js
沙漏无语25 分钟前
npm : 无法加载文件 D:\Nodejs\node_global\npm.ps1,因为在此系统上禁止运行脚本
前端·npm·node.js
supermapsupport26 分钟前
iClient3D for Cesium在Vue中快速实现场景卷帘
前端·vue.js·3d·cesium·supermap
brrdg_sefg28 分钟前
WEB 漏洞 - 文件包含漏洞深度解析
前端·网络·安全
胡西风_foxww34 分钟前
【es6复习笔记】rest参数(7)
前端·笔记·es6·参数·rest
m0_7482548836 分钟前
vue+elementui实现下拉表格多选+搜索+分页+回显+全选2.0
前端·vue.js·elementui
星就前端叭1 小时前
【开源】一款基于Vue3 + WebRTC + Node + SRS + FFmpeg搭建的直播间项目
前端·后端·开源·webrtc
m0_748234521 小时前
前端Vue3字体优化三部曲(webFont、font-spider、spa-font-spider-webpack-plugin)
前端·webpack·node.js
Web阿成1 小时前
3.学习webpack配置 尝试打包ts文件
前端·学习·webpack·typescript
sanguine__2 小时前
APIs-day2
javascript·css·css3