- <div>div 标签 1div>
- <div>div 标签 2div>
- <span>span 标签 1span>
- <span>span 标签 2span>
- html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Titletitle>
- head>
- <body>
- <div style="border: 1px solid red;">div 标签 1div>
- <div style="border: 1px solid red;">div 标签 2div>
- <span style="border: 1px solid red;">span 标签 1span>
- <span style="border: 1px solid red;">span 标签 2span>
- body>
- html>
- <div>div 标签 1div>
- <div>div 标签 2div>
- <span>span 标签 1span>
- <span>span 标签 2span>
- html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Titletitle>
- <style type="text/css">
- /* 需求 1:分别定义两个 div、span 标签,分别修改每个 div 标签的样式为:边框 1 个像素,实线,红色。*/
- div{
- border: 1px solid red;
- }
- span{
- border: 1px solid red;
- }
- style>
- head>
- <body>
- <div>div 标签 1div>
- <div>div 标签 2div>
- <span>span 标签 1span>
- <span>span 标签 2span>
- body>
- html>
- 1、css 文件内容:
- div{
- border: 1px solid yellow;
- }
- span{
- border: 1px solid red;
- }
- html 文件代码:
- html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Titletitle>
- <link rel="stylesheet" type="text/css" href="1.css"/>
- head>
- <body>
- <div>div 标签 1div>
- <div>div 标签 2div>
- <span>span 标签 1span>
- <span>span 标签 2span>
- body>
- html>
- html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>CSS 选择器title>
- <style type="text/css">
- div{
- border: 1px solid yellow;
- color: blue;
- font-size: 30px;
- }
- span{
- border: 5px dashed blue;
- color: yellow;
- font-size: 20px;
- }
- style>
- head>
- <body>
- <div>div 标签 1div>
- <div>div 标签 2div>
- <span>span 标签 1span>
- <span>span 标签 2span>
- body>
- html>
- html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>ID 选择器title>
- <style type="text/css">
- #id001{
- color: blue;
- font-size: 30px;
- border: 1px yellow solid;}
- #id002{
- color: red;
- font-size: 20px;
- border: 5px blue dotted ;
- }
- style>
- head>
- <body>
- <div id="id002">div 标签 1div>
- <div id="id001">div 标签 2div>
- body>
- html>
- <div class="class01">div 标签 class01div>
- <div class="class02">div 标签div>
- <span class="class01">span 标签 class01span>
- <span>span 标签 2span>html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>class 类型选择器title>
- <style type="text/css">
- .class01{
- color: blue;
- font-size: 30px;
- border: 1px solid yellow;
- }
- .class02{
- color: grey;
- font-size: 26px;
- border: 1px solid red;
- }
- style>
- head>
- <body>
- <div class="class02">div 标签 class01div>
- <div class="class02">div 标签div>
- <span class="class02">span 标签 class01span>
- <span>span 标签 2span>
- body>
- html>