0


CSS样式前端HTML页面常用CSS效果实现及其相关配置信息------前端入门基础教程

  1. <!DOCTYPE html>
  2. <!-- 这是HTML的注释 -->
  3. <html lang="en" id="myHtml">
  4. <head>
  5. <!-- 这里不是设置了编码,而是告诉浏览器,用什么编码方式打开文件避免乱码 -->
  6. <meta charset="UTF-8">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <title>HtmlAll</title>
  9. <!-- 这里是我们引入外部配置的Css样式文件,也是开发最主流的方式 -->
  10. <link rel="stylesheet" type="text/css" href="css.css"/>
  11. <style type="text/css">
  12. /* 这是css的语言注释 */
  13. /* id选择器,写法#后面加ID然后大括号 */
  14. #usernameError{
  15. font-size: 30px;
  16. color: red;
  17. }
  18. /* 标签选择器,这个作用范围比较广,他会对当前页面的所有该标签生效 */
  19. div{
  20. background-color: black;
  21. border: 1px solid red;
  22. width: 100px;
  23. height: 100px;
  24. }
  25. /* 类选择器,.后面类名大括号 */
  26. /* 这种方式所有是这个class都可以使用到这个效果,优点是我们可以实现跨标签 */
  27. /* 这种所有标签都可以,这要class信息一样即可 */
  28. .myClass{
  29. border: red 1px solid;
  30. width: 80px;
  31. height: 30px;
  32. }
  33. </style>
  34. </head>
  35. <body>
  36. <!-- 引入CSS效果的第一种方式,直接在元素上设置 -->
  37. <div style="width: 300px; height: 300px; background-color: #CCFFFF;
  38. display: block; border-color: red; border-width: 1px; border-style: solid;"></div>
  39. <!-- width宽度,height高度,bakgroundcolor背景色设置,display布局样式none就是隐藏,block表示显示 -->
  40. <!-- border默认不显示,我们要通过设置是否显示来显示该边框,跨域设置颜色宽度 -->
  41. <div style="width: 300px; height: 300px; background-color: #CCFFFF;
  42. display: block; border: black 1px solid;"></div>
  43. <!-- 第二种设置方法,直接在border内设置所有的信息,样式还能这样写 -->
  44. <span id="usernameError">对不起,用户名不能为空</span>
  45. <div></div>
  46. <div></div>
  47. <input type="text" class="myClass"/>
  48. <select class="myClass">
  49. <option>专科</option>
  50. <option>本科</option>
  51. <option selected>研究生</option>
  52. <option>硕士</option>
  53. </select>
  54. <a href="http://www.baidu.com">百度一下</a>
  55. <span id="baiDuSpan">点击我链接到百度</span>
  56. <ul>
  57. <li>中国
  58. <ul>
  59. <li>北京</li>
  60. <li>上海</li>
  61. <li>广州</li>
  62. </ul>
  63. </li>
  64. <li>美国</li>
  65. <li>俄国</li>
  66. </ul>
  67. <div id="div1">
  68. </div>
  69. </body>
  70. </html>
<!DOCTYPE html> <html lang="en" id="myHtml"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>HtmlAll</title> <link rel="stylesheet" type="text/css" href="css.css"/> <style type="text/css"> /* 这是css的语言注释 */ /* id选择器,写法#后面加ID然后大括号 */ #usernameError{ font-size: 30px; color: red; } /* 标签选择器,这个作用范围比较广,他会对当前页面的所有该标签生效 */ div{ background-color: black; border: 1px solid red; width: 100px; height: 100px; } /* 类选择器,.后面类名大括号 */ /* 这种方式所有是这个class都可以使用到这个效果,优点是我们可以实现跨标签 */ /* 这种所有标签都可以,这要class信息一样即可 */ .myClass{ border: red 1px solid; width: 80px; height: 30px; } </style> </head> <body>
对不起,用户名不能为空
<input type="text" class="myClass"/> <select class="myClass"> <option>专科</option> <option>本科</option> <option selected>研究生</option> <option>硕士</option> </select> 百度一下 点击我链接到百度
  • 中国
    • 北京
    • 上海
    • 广州
  • 美国
  • 俄国
  1. </div>
  2. </body>
</html>
  1. a{
  2. text-decoration: none;
  3. font: red;
  4. }
  5. #baiDuSpan
  6. {
  7. text-decoration: underline;
  8. cursor: pointer;
  9. }
  10. /* cursor是鼠标样式,pointer是小手,hand也是,建议使用pointer */
  11. /* wait会显示转圈圈 */
  12. ul{
  13. list-style-type: none;
  14. }
  15. /* 通过设置list-style-type为none就可以去掉我们无序列表和有序列表的前面的符号 */
  16. #div1{
  17. position: absolute;
  18. border: 1px solid black;
  19. width: 300px;
  20. height: 300px;
  21. left: 100px;
  22. right: 100px;
  23. }
  24. /* position: absolute;设置绝对定位 */

a{
text-decoration: none;
font: red;
}

#baiDuSpan
{
text-decoration: underline;
cursor: pointer;
}

/* cursor是鼠标样式,pointer是小手,hand也是,建议使用pointer /
/
wait会显示转圈圈 */

ul{
list-style-type: none;
}
/* 通过设置list-style-type为none就可以去掉我们无序列表和有序列表的前面的符号 */

#div1{
position: absolute;
border: 1px solid black;
width: 300px;
height: 300px;
left: 100px;
right: 100px;
}
/* position: absolute;设置绝对定位 */

标签: css3 css 前端

本文转载自: https://blog.csdn.net/2201_75960169/article/details/134160802
版权归原作者 旧约Alatus 所有, 如有侵权,请联系我们删除。

“CSS样式前端HTML页面常用CSS效果实现及其相关配置信息------前端入门基础教程”的评论:

还没有评论