CSS常见样式

字体相关的样式

		<style>
			div{
				/* 斜体 */
				font-style: italic;
				/* 加粗 100-900*/
				font-weight: 900;
				/* 字体大小 */
				font-size: 20px;
				/* 声明字体格式 */
				font-family: "微软雅黑";
			}
		</style>

div内部文字垂直居中

只需要将行高设为其height的大小即可。

div{
				text-align: center;
				line-height: 100px;
			}

文本相关的样式

		<style>
			p{
				/* 缩进 */
				text-indent: 2em;
				/* 行高 */
				line-height: 20px;
			}
			div{
				/* 设置div的宽和高以及背景颜色 */
				width: 200px;
				height: 200px;
				background-color: skyblue;
				/* 设置字对齐方式 */
				text-align: center;
				/* 设置行高*/
				line-height: 200px;
			}
		</style>

文本装饰

		<style>
			a{
				/* 删除超链接的下划线 */
				text-decoration: none;
				/* 改变颜色 */
				color: bisque;
			}
		</style>

列表相关样式

	<style>
		li{
			/* 删除列表前面的黑点 */
			list-style-type: none;
			/* 设置为图片 */
			list-style-image: url(./images/懒洋洋.jpg); 
			/* 设置黑点的定位 */
			list-style-position: inside;
		}
	</style>

背景 

		<style>
			body{
				height: 5000px;
				/* 背景颜色 */
				background-color: aqua;
				/* 背景图片 */
				background-image: url(./王者背景.jpg);
				/* 设置背景不重复 */
				background-repeat: no-repeat;
				/* 设置定位 */
				background-position: 45px 30px; 
				/* 固定背景图 */
				background-attachment: fixed;
				/* 背景图强制铺满 */
				background-size: cover;
			}
			div{
				width: 100px;
				height: 100px;
				background-color: pink;
				margin: 0 auto;
			}
		</style>

隐藏元素

		<style>
			div{
				/* 隐藏元素1 */
				display: none;
				/* 隐藏元素2 */
				visibility: hidden;
				/* 隐藏元素3 */
				opacity: 0;
				height: 200px;
				width: 200px;
				background-color: pink;
			}
		</style>

元素类型

		<style>
			/* 将其他元素转化为块元素 */
			span{
				display: block;
			}
		</style>
		<style>
			/* 转为行内块元素 */
			div{
				display: inline-block
			}
		</style>

边框

		<style>
			div{
				width: 300px;
				height: 100px;
				background-color: aqua;
				/* 设置边框像素 */
 				border-width: 20px;
				/* 设置边框样式 */
				border-style: double;
				/* 设置边框颜色 */
				border-color: pink; 
				/* 合并写 */
				border: 20px double pink;
				/* 设置边框弧度 */
				border-radius: 10px;
			}
		</style>

合并单元格相邻部分

		<style>
			td{
				border: 1px solid black;
			}
			table{
				border-collapse: collapse;
			}
		</style>

文本域

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			textarea{
				/* 禁止拖拽 */
				resize: none;
				/* 改变悬停时的鼠标样子 */
				cursor: col-resize;
			}
		</style>
	</head>
	<body>
		<textarea name="" id="" cols="30" rows="10"></textarea>
	</body>
</html>

相关推荐

  1. WEB前端CSS常见样式以及各种简单样式

    2024-04-11 11:52:03       50 阅读
  2. CSS样式

    2024-04-11 11:52:03       45 阅读
  3. <span style='color:red;'>css</span><span style='color:red;'>样式</span>

    css样式

    2024-04-11 11:52:03      24 阅读
  4. CSS】前端开发中的常见CSS样式问题解决方案

    2024-04-11 11:52:03       40 阅读
  5. CSS基础——1.CSS样式

    2024-04-11 11:52:03       34 阅读
  6. CSS3新增样式

    2024-04-11 11:52:03       61 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-11 11:52:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-11 11:52:03       101 阅读
  3. 在Django里面运行非项目文件

    2024-04-11 11:52:03       82 阅读
  4. Python语言-面向对象

    2024-04-11 11:52:03       91 阅读

热门阅读

  1. 设计模式(015)行为型之模板方法模式

    2024-04-11 11:52:03       37 阅读
  2. Android bug Unresolved reference: BR

    2024-04-11 11:52:03       31 阅读
  3. LeetCode hot100-24

    2024-04-11 11:52:03       36 阅读
  4. Day10:学习尚上优选项目

    2024-04-11 11:52:03       28 阅读
  5. c++和R语言数据类型的比较

    2024-04-11 11:52:03       34 阅读
  6. docker重启错误-重启命令一直卡住

    2024-04-11 11:52:03       36 阅读
  7. Linux命令学习—linux 的常用命令

    2024-04-11 11:52:03       29 阅读