HTML_CSS学习:常用文本属性

embedded/2024/9/23 10:37:09/
htmledit_views">

一、文本颜色

相关代码:

html"><!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>文本颜色</title><style>div{font-size: 90px;}.atguigu1{color: #238c20;}.atguigu2{color: rgb(255,0,0);}.atguigu3{color: rgba(0,255,0,0.5);}.atguigu4{color: #0000ff;}.atguigu5{color: #0000ff88;}.atguigu6{color: hsl(0,100%,50%);}.atguigu7{color: hsla(0,100%,50%,0.5);background-color: orange;}/*属性名:color*//*可选值:*//*1.颜色值*//* 2.rgb或rgba*//*  3.HEX或HEXA*//*   4.HSL或HSLA*//*    开发中常用的是 rgb/rgba  或HEX\HEXA(十六进制)*/</style>
</head>
<body><div class="atguigu1">尚硅谷1</div><div class="atguigu2">尚硅谷2</div><div class="atguigu3">尚硅谷3</div><div class="atguigu4">尚硅谷4</div><div class="atguigu5">尚硅谷5</div><div class="atguigu6">尚硅谷6</div><div class="atguigu7">尚硅谷7</div></body>
</html>

显示结果:

二、文本间距

相关代码:

html"><!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>文本间距</title><style>div{font-size: 30px;}.atguigu2{/*字符间距*/letter-spacing: 20px;}.atguigu3{/*单词之间的间距*/word-spacing: 20px;}</style>
</head>
<body><div>The knowledge points of the article.尚硅谷1</div><div class="atguigu2">The knowledge points of the article.尚硅谷2</div><div class="atguigu3">The knowledge points of the article.尚硅谷3</div></body>
</html>

显示结果:

三、文本修饰

相关代码:

html"><!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>文本修饰</title><style>div{font-size: 40px;}.atguigu1{/*上划的虚线*/text-decoration: overline dotted greenyellow;/*属性没有顺序要求*/}.atguigu2{/*text-decoration: underline dotted;*//*下划的波浪线*/text-decoration: underline wavy red;}.atguigu3{/*删除线*/text-decoration: line-through;}/*.atguigu4{*//*    text-decoration: none;*//*}*/.atguigu4,ins,del{/*没有各种线*/font-size: 40px;text-decoration: none;}</style>
</head>
<body><div class="atguigu1">尚硅谷1</div><div class="atguigu2">尚硅谷2</div><div class="atguigu3">尚硅谷3</div><a class="atguigu4" href="https://www.baidu.com">尚硅谷4</a><br><ins>测试1</ins><br><del>测试2</del></body>
</html>

显示结果:

四、文本缩进

相关代码:

html"><!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>文本缩进</title><style>div{font-size: 60px;text-indent: 120px ;}</style>
</head>
<body><div>欢迎来到信阳农林学院!欢迎来到信阳农林学院!欢迎来到信阳农林学院!欢迎来到信阳农林学院!</div></body>
</html>

显示结果:

五、文本对齐_水平

相关代码:

html"><!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>文本对齐</title><style>div{font-size: 40px;background-color: orange;/*text-align: left;*/text-align: center;/*文本对齐_水平*//*常用值:*//*1.left:左对齐*//*2.right:右对齐*//*3.center:居中对齐*/}</style>
</head>
<body><div>尚硅谷</div></body>
</html>

显示结果:

六、细说font-size

相关代码:

html"><!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>细说font-size</title><style>div{font-size: 40px;}/*由于字体设计原因,文字最终呈现的大小,并不一定与font-size的值一致,可能大,也可能小*//*例如:font-size设为40px,最终呈现的文字,可能比40px大,也可能比40px小*//*通常情况下,文字相对字体设计框,并不是垂直居中的,通常靠下一点*/</style>
</head>
<body><div>atguigu尚硅谷</div><br><span style="font-size: 40px;font-family: '微软雅黑';">尚</span><br><span style="font-size: 40px;font-family: 隶书;">尚</span><br><span style="font-size: 40px;font-family: 楷书;">尚</span></body>
</html>

显示结果:

七、行高

相关代码:

html"><!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>行高</title><style>#d1{font-size: 20px;background-color: #999ff0;line-height: 20px;/*第一种写法,值为像素*//*line-height:40px;*//*第二种写法,值为normal*//*line-height:normal;*//*font-family: "隶书";*//*第三种写法:值为数值*/line-height: 1.5;/*1相当于1.5*40px 相当于写的60px*//*第四种写法:值为百分比*/line-height: 150%;}/*由于字体设计原因,文字在一行中,并不是绝对垂直居中,若一行中都是文字,不会影响观感*/</style>
</head>
<body><div id="d1">atguigu尚硅谷让天下没有难掉的头发</div></body>
</html>

显示结果:

八、行高注意事项

相关代码:

html"><!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>行高注意事项</title><style>/*注意点1:行高过小会怎样?--文字重叠,且最小值是0,不能为负数*/#d1{font-size: 40px;background-color: #999ff0;line-height: 0;}/*注意点2:行高是可以继承的*/#d2{font-size: 40px;background-color: #37d2a6;line-height: 1.5;}span{font-size: 200px;color: yellow;}/*注意点3:line-height和height是什么关系*//*设置了height,高度就是height的值*//*没有设置height,高度就是line-height*行数*/#d3{font-size: 40px;background-color: #be6f0e;line-height: 100px;/*height: 300px;*/}#d4{font-size: 40px;background-color: skyblue;line-height: 0px;}/*行高的应用场景1:调整多行文字的间距*/#d5{font-size: 40px;background-color: salmon;line-height: 100px;}/*行高的应用场景2:单行文字的垂直居中  height等于line-height*/#d6{font-size: 40px;background-color: #0ebe90;height: 300px;line-height: 300px;}</style>
</head>
<body>
<!--    <div id="d1">atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发</div>-->
<!--    <div id="d2">atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发atguigu<span>尚硅谷</span>让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发</div>-->
<!--    <div id="d3">atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发vatguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发</div>-->
<!--    <div id="d4">atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发vatguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发</div>-->
<!--    <div id="d5">atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发vatguigu尚硅谷让天下没有难掉的头发atguigu尚硅谷让天下没有难掉的头发</div>--><div id="d6">atguigu尚硅谷让天下没有难掉的头发</div></body>
</html>

显示结果:

九、文本对齐_垂直

相关代码:

html"><!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>文本对齐_垂直</title><style>div{font-size: 40px;height: 400px;line-height: 760px;background-color: skyblue;font-family: "华文隶书";/*顶部:无需任何属性,在垂直方向上,默认就是顶部对齐*//*居中:对于单行文字,让height=line-height即可*//*底部:对于单行文字,目前一个临时的方式:*//*让line-height=(heightx2) - font-size - x*/}</style>
</head>
<body><div>尚硅谷</div></body>
</html>

显示结果:

十、vertical-align

相关代码:

html"><!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>vertical-align</title><style>div{font-size: 100px;height: 300px;background-color: #999ff0;}span{font-size: 40px;background-color: orange;/*vertical-align: top;*//*vertical-align: bottom;*/vertical-align: middle;}/*img{*//*    height: 30px;*//*    !*vertical-align: top;*!*//*    !*vertical-align: bottom;*!*//*    vertical-align: middle;*//*}*/img{height: 50px;vertical-align: bottom;/*图片在动:由最高的哪一个决定,图片的高度较高*/}.san{vertical-align: middle;}/*.test1{*//*    width: 400px;*//*    height: 400px;*//*    background-color: #0dcaf0;*//*}*//*.test2{*//*    width: 100px;*//*    height: 100px;*//*    background-color: #0ebe90;*//*    vertical-align: bottom;*//*}*//*反例:text*//*.test{*//*    width: 400px;*//*    height: 400px;*//*    background-color: green;*//*    vertical-align: middle;*//*}*/</style>
</head>
<body><div>atguigu尚硅谷x<span>x前端</span></div><hr><div>atguigu尚硅谷x<img src="../pictures/喜羊羊.jpg"></div><hr>
<!--    <div class="test">123</div>-->
<!--    <div class="test1">-->
<!--        <div class="test2"></div>-->
<!--    </div>--><table border="1"cellspacing="0"><caption>人员信息</caption><thead><tr><th>姓名</th><th>年龄</th><th>性别</th></tr></thead><tbody><tr height="200">
<!--                <td valign="bottom">张三</td>--><td class="san">张三</td><td>18</td><td>男</td></tr><tr><td>李四</td><td>20</td><td>女</td></tr></tbody></table></body>
</html>

显示结果:


http://www.ppmy.cn/embedded/31221.html

相关文章

【华为 ICT HCIA eNSP 习题汇总】——题目集19

1、&#xff08;多选&#xff09;以下选项中&#xff0c;FTP 常用文件传输类型有&#xff08;&#xff09;。 A、ASCII 码类型 B、二进制类型 C、EBCDIC 类型 D、本地类型 考点&#xff1a;应用层 解析&#xff1a;&#xff08;AB&#xff09; 文件传输协议&#xff08;FTP&…

谈谈TCP Socket中写数据的函数---write、send 、sendv

write函数 将数据写入到 TCP 连接中。原型&#xff1a;ssize_t write(int sockfd, const void *buf, size_t count); -sockfd&#xff1a;TCP Socket 描述符。 -buf&#xff1a;要发送的数据缓冲区。 -count&#xff1a;要发送的字节数。 -返回值&#xff1a;成功时返回实际发…

k8s crd inferenceservices.serving.kserve.io

背景 ArgoCD无法连接到k8s集群 日志如下&#xff1a; Failed to load live state: failed to get cluster info for "https://kubernetes.default.svc": error synchronizing cache state : failed to sync cluster https://10.233.0.1:443: failed to load initia…

编译Qt6.5.3LTS版本(Mac/Windows)的mysql驱动(附带编译后的全部文件)

文章目录 0 背景1 编译过程2 福利参考 0 背景 因为项目要用到对MYSQL数据库操作&#xff0c;所以需要连接到MYSQL数据库。但是连接需要MYSQL驱动&#xff0c;但是Qt本身不自带MYSQL驱动&#xff0c;需要自行编译。网上有很多qt之前版本的mysql驱动&#xff0c;但是没有找到qt6…

神经网络中的优化方法

一、引入 在传统的梯度下降优化算法中&#xff0c;如果碰到平缓区域&#xff0c;梯度值较小&#xff0c;参数优化变慢 &#xff0c;遇到鞍点&#xff08;是指在某些方向上梯度为零而在其他方向上梯度非零的点。&#xff09;&#xff0c;梯度为 0&#xff0c;参数无法优化&…

【004_音频开发_基础篇_ALSA插件使用】

004_音频开发_基础篇_ALSA插件使用 文章目录 004_音频开发_基础篇_ALSA插件使用创作背景/etc/asound.conf 示例分析默认设备/默认控制器/plug插件softvol 插件采样率转换插件pcm.audio_processing 创作背景 学历代表过去、能力代表现在、学习力代表将来。 一个良好的学习方法是…

怎么用 C2CM 什么是c2cm

C2CM&#xff08;Conv2D-Conv2D Matching&#xff09;是一个并非正式或广泛使用的术语&#xff0c;但基于上下文&#xff0c;我们可以将其理解为一种在深度学习模型中使用的技术&#xff0c;其中两个连续的二维卷积层通过某种方式相互连接或匹配&#xff0c;以提高特征提取的效…

UDP编程流程(UDP客户端、服务器互发消息流程)

一、UDP编程流程 1.1、 UDP概述 UDP&#xff0c;即用户数据报协议&#xff0c;是一种面向无连接的传输层协议。相比于TCP协议&#xff0c;UDP具有以下特点&#xff1a; 速度较快&#xff1a;由于UDP不需要建立连接和进行复杂的握手过程&#xff0c;因此在传输数据时速度稍快…