• css3-超链接伪类、列表、背景渐变


    目录

    1.文本阴影和超链接伪类

    2.列表样式学习

    3.背景图像应用及渐变


    1.文本阴影和超链接伪类

    1. html>
    2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
    3. <head>
    4. <meta charset="UTF-8">
    5. <title>Titletitle>
    6. <style>
    7. /*默认的颜色*/
    8. a{
    9. text-decoration: none;
    10. color: #000000;
    11. }
    12. /*鼠标悬浮的颜色*/
    13. a:hover{
    14. color: deeppink;
    15. font-size: 50px;
    16. }
    17. /*鼠标按住未释放*/
    18. a:active{
    19. color: chartreuse;
    20. }
    21. a:visited{
    22. color: darkblue;
    23. }
    24. #price{
    25. /*三个参数:阴影颜色 水平偏移 垂直偏移 阴影半径*/
    26. text-shadow: skyblue 10px 0px 2px;
    27. }
    28. style>
    29. head>
    30. <body>
    31. <a href="#">
    32. <img src="images/a.jpeg" alt="">
    33. a>
    34. <p>
    35. <a href="#">css3a>
    36. p>
    37. <p>
    38. <a href="#">biua>
    39. p>
    40. <p id="price">
    41. ¥9.9
    42. p>
    43. body>
    44. html>

    2.列表样式学习

    list-style:

            none:去圆点 同时也可以去掉有序列表中的数字

            circle:空心圆   (有序列表中decimal:数字)

            square:正方形

    页面结构:

    1. html>
    2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
    3. <head>
    4. <meta charset="UTF-8">
    5. <title>Titletitle>
    6. <link href="css/style.css" rel="stylesheet" type="text/css">
    7. head>
    8. <body>
    9. <div id="nav">
    10. <h2 class="title">全部商品分类h2>
    11. <ul>
    12. <li>
    13. <a href="#">图书a>
    14. <a href="#">音像a>
    15. <a href="#">数字商品a>
    16. li>
    17. <li>
    18. <a href="#">家用电器a>
    19. <a href="#">手机a>
    20. <a href="#">数码a>
    21. li>
    22. <li>
    23. <a href="#">电脑a>
    24. <a href="#">办公a>
    25. li>
    26. <li>
    27. <a href="#">家居a>
    28. <a href="#">家装a>
    29. <a href="#">厨具a>
    30. li>
    31. <li>
    32. <a href="#">服饰鞋帽a>
    33. <a href="#">个性化妆a>
    34. li>
    35. <li>
    36. <a href="#">礼品箱包a>
    37. <a href="#">钟表a>
    38. <a href="#">珠宝a>
    39. li>
    40. <li>
    41. <a href="#">食品饮料a>
    42. <a href="#">保健食品a>
    43. li>
    44. <li>
    45. <a href="#">彩票a>
    46. <a href="#">旅行a>
    47. <a href="#">充值a>
    48. <a href="#">票务a>
    49. li>
    50. ul>
    51. div>
    52. body>
    53. html>

    样式部分:

    1. #nav{
    2. width: 300px;
    3. }
    4. .title{
    5. font-size: 18px;
    6. font-weight: bold;
    7. text-indent: 1em;
    8. line-height: 30px;
    9. background-color: antiquewhite;
    10. }
    11. /*
    12. list-style:
    13. none:去圆点 同时也可以去掉有序列表中的数字
    14. circle:空心圆(有序列表中decimal:数字)
    15. square:正方形
    16. */
    17. ul{
    18. background-color: azure;
    19. }
    20. ul li{
    21. height: 30px;
    22. list-style: none;
    23. text-indent:1em;
    24. }
    25. a{
    26. text-decoration: none;
    27. font-size: 14px;
    28. color: black;
    29. }
    30. a:hover{
    31. color: coral;
    32. text-decoration: underline;
    33. }

    3.背景图像应用及渐变

    background-image:url("");/*默认是全部平铺的*/
    background-repeat:repeat-x/*水平平铺*/
    background-repeat:repeat-y/*垂直平铺*/
    background-repeat:no-repeat/*不平铺*/

    测试选取一张图片作为背景:

    1. html>
    2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
    3. <head>
    4. <meta charset="UTF-8">
    5. <title>Titletitle>
    6. <style>
    7. div{
    8. width: 1000px;
    9. height: 700px;
    10. border: 1px solid rebeccapurple;
    11. /*默认是全部平铺的*/
    12. background-image: url("images/a.PNG");
    13. }
    14. .div1{
    15. background-repeat: repeat-x;
    16. }
    17. .div2{
    18. background-repeat: repeat-y;
    19. }
    20. .div3{
    21. background-repeat: no-repeat;
    22. }
    23. style>
    24. head>
    25. <body>
    26. <div class="div1">div>
    27. <div class="div2">div>
    28. <div class="div3">div>
    29. body>
    30. html>

    基于第二部分的代码,添加右箭头和下箭头标识:

    效果如下:

    页面结构未变,只修改了css部分:

    1. #nav{
    2. width: 300px;
    3. }
    4. .title{
    5. font-size: 18px;
    6. font-weight: bold;
    7. text-indent: 1em;
    8. line-height: 30px;
    9. /*颜色 图片 图片设置 平铺方式*/
    10. background: antiquewhite url("../images/b.PNG") 270px 0px no-repeat;
    11. }
    12. /*
    13. list-style:
    14. none:去圆点 同时也可以去掉有序列表中的数字
    15. circle:空心圆(有序列表中decimal:数字)
    16. square:正方形
    17. */
    18. ul{
    19. background-color: azure;
    20. }
    21. ul li{
    22. height: 30px;
    23. list-style: none;
    24. text-indent:1em;
    25. background-image: url("../images/a.PNG");
    26. background-repeat: no-repeat;
    27. background-position:220px 0px ;
    28. }
    29. a{
    30. text-decoration: none;
    31. font-size: 14px;
    32. color: black;
    33. }
    34. a:hover{
    35. color: coral;
    36. text-decoration: underline;
    37. }

    测试背景渐变:

    获取渐变背景网站:Grabient

    径向渐变、圆形渐变

    1. html>
    2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
    3. <head>
    4. <meta charset="UTF-8">
    5. <title>Titletitle>
    6. <style>
    7. body{
    8. background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%);
    9. ;
    10. }
    11. style>
    12. head>
    13. <body>
    14. hihi
    15. body>
    16. html>
  • 相关阅读:
    表单识别(六)——票据识别-论文研读:基于深度学习的票据识别系统设计与实现,卞飞飞(中)
    Python语言 :逻辑运算符知识点讲解
    【云原生|K8s系列第5篇】:实战使用Service暴露应用
    keras-gpu安装
    C#中委托和事件的使用总结
    搜维尔科技:利用虚拟现实优化汽车仪表盘或飞机驾驶舱的人机工程学设计
    南大通用数据库-Gbase-8a-学习-08-集群节点添加数据副本
    Python---异常
    关于SRE在金融行业落地的探讨
    证书格式说明
  • 原文地址:https://blog.csdn.net/qq_61727355/article/details/126583488