CSS-1

截屏2022-08-06 21.33.43.png

text-align:center 內(nèi)容居中。
margin:0 auto; 一般是用來修飾外部的div你辣。

1.選擇器分為眷细,標(biāo)簽選擇器拦盹,類選擇器,id選擇器溪椎,通配符選擇器

文字的加粗普舆,文字的大小恬口,文字的傾斜,文字的樣式沼侣,文本的縮近祖能,
文本內(nèi)容水平對齊,文本修飾線蛾洛,

  <link rel="stylesheet" href="my.css">
  <!-- 外聯(lián)式 -->
 <!-- 內(nèi)嵌式 -->
     <style>
        /* CSS的注釋 */
        p{
          color: green;
          font-size: 30px;
          /* 1.文字大小养铸,需要添加px */
          background-color: gainsboro;
          /* 2.背景顏色 */
          width: 400px;
          height: 50px;
        }
    </style> 
 <!-- 行內(nèi)式 -->
 <p style="color:blue">顏色</p>
       .red {
            color: red;
        }

        .blue {
            color: blue;
        }

        #yel {
            color: yellow;
        }

        .size {
            font-size: 20px;
            /* 字號 加px  默認(rèn)的字號是16px */
        }

        .weight {
            font-weight: 700;
            /* bold = 700 默認(rèn)是400不加粗*/
        }

        .em {
            font-style: italic;
            /* 傾斜 */
        }

        .fontStyle {
            font-family: 微軟雅黑, 黑體, sans-serif;
            /* 電腦中依次向后找,如果沒有微軟雅黑轧膘,就 */
        }

        * {
            margin: 0;
            padding: 0;
            color: yellowgreen;
        }

        .r {
            font: italic 700 30px 宋體;
            /* 復(fù)合屬性 只能省略前兩個 */
            font-style: normal;
        }

        .indent {
            text-indent: 2em;
        }

2.行高

        .textIndent {
            text-indent: 2em;
            /* line-height: 20px; */ 
            /* 可以填寫倍數(shù)和填寫像素大小 */
            /* font: normal 700 20px/1.5 黑體; */
            color: #333333;
            background-color: rgba(0, 255, 0, 0.3);
        }

3. margin: 0 auto;

4.text-align:center 內(nèi)容居中

      .title {
            color: black;
            /* font-size: 20px; */
            text-align: center;
            font: normal 400 20px 黑體;
        }
        body {
            text-align: center;
        }

5.text-decoration:文本的修飾線

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
    <style>
        a {
            text-decoration: none;
        }
        h1 {
            text-decoration: line-through;
        }
        div {
            text-decoration: underline;
        }
        p {
            text-decoration: overline;
        }
    </style>
</head>
<body>
    <!-- 文本修飾線 -->
    <a href="">我是鏈接標(biāo)簽</a>
    <h1>我是h1標(biāo)簽</h1>
    <div>我是div標(biāo)簽</div>
    <p>我是p標(biāo)簽</p>
</body>
</html>

6.demo1

截屏2022-08-06 22.01.26.png
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .content {
            margin: 0 auto;
            width: 1000px;
            height: 600px;
            background-color: yellowgreen;
        }

        .center {
            text-align: center;
        }

        a {
            text-decoration: none;
        }
        .indent {
            text-indent: 2em;
        }
    </style>
</head>

<body>
    <div class="content">
        <h1 class="center">南海戰(zhàn)略態(tài)勢感知:美軍“里根”號航母已轉(zhuǎn)向</h1>
        <p class="center">
            <span>2022-08-06 15:29</span>
            <a href="#">收藏</a>
        </p>
        <hr>
        <p class="indent">【里根號航母已轉(zhuǎn)向】8月6日中午钞螟,根據(jù)“里根”號航母艦載機(jī)“灰狗”C-2A的飛行軌跡判斷,
            “羅納德·里根”航母打擊群已于5日開始折返谎碍。與5日上午相比筛圆,至6日中午,其已向西南方向移動了約230海里椿浓。</p>
    </div>

</body>

</html>

7.demo2

截屏2022-08-06 21.48.29.png
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            background-color: #f5f5f5;
        }

        .goods {
            width: 234px;
            height: 300px;
            background-color: white;
            margin: 0 auto;
            text-align: center;
        }

        .goodsImg {
            width: 160px;
            height: 160px;
        }

        .shopTitle {
            line-height: 25px;
            /* background-color: yellow; */
        }

        .shopContent {
            font: 12px;
            color: #ccc;
            /* background-color: blue; */
        }

        .shopPrice {
            font-size: 14px;
            color: #ffa500;
        }
    </style>
</head>
<body>
    <div class="goods">
        <img class="goodsImg"
            src="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/0f8abb2bc3947c4679e3f1b2aafc28c0.jpg?thumb=1&w=400&h=400&f=webp&q=90"
            alt="">
        <h3 class="shopTitle">電腦</h3>
        <p class="shopContent">專業(yè)影響</p>
        <p class="shopPrice">5999元起</p>
    </div>
</body>
</html>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市闽晦,隨后出現(xiàn)的幾起案子扳碍,更是在濱河造成了極大的恐慌,老刑警劉巖仙蛉,帶你破解...
    沈念sama閱讀 218,525評論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件笋敞,死亡現(xiàn)場離奇詭異,居然都是意外死亡荠瘪,警方通過查閱死者的電腦和手機(jī)夯巷,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,203評論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來哀墓,“玉大人趁餐,你說我怎么就攤上這事±捍拢” “怎么了后雷?”我有些...
    開封第一講書人閱讀 164,862評論 0 354
  • 文/不壞的土叔 我叫張陵,是天一觀的道長吠各。 經(jīng)常有香客問我臀突,道長,這世上最難降的妖魔是什么贾漏? 我笑而不...
    開封第一講書人閱讀 58,728評論 1 294
  • 正文 為了忘掉前任候学,我火速辦了婚禮,結(jié)果婚禮上纵散,老公的妹妹穿的比我還像新娘梳码。我一直安慰自己隐圾,他們只是感情好,可當(dāng)我...
    茶點故事閱讀 67,743評論 6 392
  • 文/花漫 我一把揭開白布边翁。 她就那樣靜靜地躺著翎承,像睡著了一般。 火紅的嫁衣襯著肌膚如雪符匾。 梳的紋絲不亂的頭發(fā)上叨咖,一...
    開封第一講書人閱讀 51,590評論 1 305
  • 那天,我揣著相機(jī)與錄音啊胶,去河邊找鬼甸各。 笑死,一個胖子當(dāng)著我的面吹牛焰坪,可吹牛的內(nèi)容都是我干的趣倾。 我是一名探鬼主播,決...
    沈念sama閱讀 40,330評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼某饰,長吁一口氣:“原來是場噩夢啊……” “哼儒恋!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起黔漂,我...
    開封第一講書人閱讀 39,244評論 0 276
  • 序言:老撾萬榮一對情侶失蹤诫尽,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后炬守,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體牧嫉,經(jīng)...
    沈念sama閱讀 45,693評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,885評論 3 336
  • 正文 我和宋清朗相戀三年减途,在試婚紗的時候發(fā)現(xiàn)自己被綠了酣藻。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,001評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡鳍置,死狀恐怖辽剧,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情税产,我是刑警寧澤抖仅,帶...
    沈念sama閱讀 35,723評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站砖第,受9級特大地震影響撤卢,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜梧兼,卻給世界環(huán)境...
    茶點故事閱讀 41,343評論 3 330
  • 文/蒙蒙 一放吩、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧羽杰,春花似錦渡紫、人聲如沸到推。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,919評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽莉测。三九已至,卻和暖如春唧喉,著一層夾襖步出監(jiān)牢的瞬間捣卤,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,042評論 1 270
  • 我被黑心中介騙來泰國打工八孝, 沒想到剛下飛機(jī)就差點兒被人妖公主榨干…… 1. 我叫王不留董朝,地道東北人。 一個月前我還...
    沈念sama閱讀 48,191評論 3 370
  • 正文 我出身青樓干跛,卻偏偏與公主長得像子姜,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子楼入,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,955評論 2 355