02-style.html 870 B

123456789101112131415161718192021222324252627282930313233
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <!-- 将body中要使用的样式 抽取到head中 -->
  8. <style>
  9. /* 对input元素生效 这里是css的注释方式*/
  10. input {
  11. width: 60px;
  12. height: 40px;
  13. background-color: bisque;
  14. border: 1px solid yellowgreen;
  15. font-size: 22px;
  16. font-family: '隶书';
  17. border-radius: 5px;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <!-- 内嵌式 css -->
  23. <!-- 缺点:生效范围在当前的html页面中 如果想要复用这个效果 在新的页面还需要复制一份 -->
  24. <input type="button" value="按钮1" />
  25. <br />
  26. <br />
  27. <input type="button" value="按钮2" />
  28. </body>
  29. </html>