HTML内置css改变文字效果,CSS+HTML<文字效果>

本文展示了多个使用CSS实现的文字效果,包括文字反射、描边、下划线、阴影等静态样式,并提示可以添加hover效果以实现动态过渡。通过这些例子,读者可以学习如何利用CSS提升网页文字的视觉吸引力。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

下面归类一些简单的文字效果,此处都为静态样式,想要动态的,可以根据自身需求添加 hover 效果。

Hello World

效果1:

52bc53cb6fb9

image.png

h1 {

-webkit-box-reflect: below -0.25em linear-gradient(transparent 0%, rgba(255, 255, 255, .6) 100%);

}

效果2:

52bc53cb6fb9

image.png

h1 {

/* 文字描边 width color */

-webkit-text-stroke: 0.05rem black;

color: transparent;

text-shadow: -5px 0 rgba(0, 255, 255, 0.4), 5px 0 rgba(255, 0, 255, 0.4);

}

效果3:

52bc53cb6fb9

image.png

知识点:text-decoration 属性

h1 {

text-decoration: line-through;

}

效果4:

52bc53cb6fb9

image.png

h1 {

color: #f4f4f4;

text-shadow: -1px -1px white, 1px 1px gray, 2px 2px #7a7a7a, 3px 3px #757575, 4px 4px #707070, 5px 5px #6b6b6b, 6px 6px #666666, 7px 7px #616161, 8px 8px #5c5c5c, 9px 9px #575757;

}

效果5:

52bc53cb6fb9

image.png

h1 {

color: transparent;

background-image: linear-gradient( transparent 0%,transparent 50%,#447df7 50%, #447df7 100%);

-webkit-background-clip: text;

-webkit-text-stroke: 0.05rem #447df7;

}

效果6:

52bc53cb6fb9

image.png

h1 {

color: transparent;

text-shadow: 0 0 5px black;

}

效果7:

52bc53cb6fb9

image.png

h1 {

/* 文字间距 */

letter-spacing: .3rem;

text-shadow: 1px 1px 0px white,3px 3px 0px black;

}

<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>Login</class> <widget class="QWidget" name="Login"> <property name="windowModality"> <enum>Qt::ApplicationModal</enum> </property> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>652</width> <height>385</height> </rect> </property> <property name="windowTitle"> <string>图书馆管理系统</string> </property> <widget class="QLabel" name="label"> <property name="geometry"> <rect> <x>20</x> <y>20</y> <width>111</width> <height>41</height> </rect> </property> <property name="text"> <string><html><head/><body><p><span style=" font-size:16pt;">用户登录</span></p></body></html></string> </property> <property name="textFormat"> <enum>Qt::AutoText</enum> </property> </widget> <widget class="QLabel" name="user"> <property name="geometry"> <rect> <x>150</x> <y>90</y> <width>60</width> <height>41</height> </rect> </property> <property name="text"> <string><html><head/><body><p><span style=" font-size:12pt;">用户名</span></p></body></html></string> </property> </widget> <widget class="QLabel" name="password"> <property name="geometry"> <rect> <x>160</x> <y>150</y> <width>60</width> <height>26</height> </rect> </property> <property name="text"> <string><html><head/><body><p><span style=" font-size:12pt;">密码</span></p></body></html></string> </property> </widget> <widget class="QLabel" name="identify"> <property name="geometry"> <rect> <x>140</x> <y>180</y> <width>91</width> <height>59</height> </rect> </property> <property name="text"> <string><html><head/><body><p><span style=" font-size:12pt;">身份类型</span></p></body></html></string> </property> </widget> <widget class="QLineEdit" name="userline"> <property name="geometry"> <rect> <x>290</x> <y>100</y> <width>191</width> <height>21</height> </rect> </property> </widget> <widget class="QLineEdit" name="pwline"> <property name="geometry"> <rect> <x>290</x> <y>150</y> <width>191</width> <height>21</height> </rect> </property> <property name="echoMode"> <enum>QLineEdit::Password</enum> </property> </widget> <widget class="QComboBox" name="idbox"> <property name="geometry"> <rect> <x>320</x> <y>200</y> <width>121</width> <height>22</height> </rect> </property> <item> <property name="text"> <string>读者</string> </property> </item> <item> <property name="text"> <string>图书管理员</string> </property> </item> <item> <property name="text"> <string>系统管理员</string> </property> </item> </widget> <widget class="QPushButton" name="loginbt"> <property name="geometry"> <rect> <x>250</x> <y>270</y> <width>93</width> <height>28</height> </rect> </property> <property name="text"> <string>登录</string> </property> </widget> <widget class="QPushButton" name="exitbt"> <property name="geometry"> <rect> <x>420</x> <y>270</y> <width>93</width> <height>28</height> </rect> </property> <property name="text"> <string>退出</string> </property> </widget> </widget> <resources/> <connections/> </ui> 美化UI
最新发布
05-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值