zoukankan      html  css  js  c++  java
  • 2021.1.26

    今日学习内容:html 块

    对 HTML 进行分类(设置类),使我们能够为元素的类定义 CSS 样式。

    为相同的类设置相同的样式,或者为不同的类设置不同的样式。

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    .cities {
        background-color:black;
        color:white;
        margin:20px;
        padding:20px;
    } 
    </style>
    </head>
    
    <body>
    
    <div class="cities">
    <h2>London</h2>
    <p>
    London is the capital city of England. 
    It is the most populous city in the United Kingdom, 
    with a metropolitan area of over 13 million inhabitants.
    </p>
    </div> 
    
    </body>
    </html>

     

    分类块级元素

    HTML <div> 元素是块级元素。它能够用作其他 HTML 元素的容器。

    设置 <div> 元素的类,使我们能够为相同的 <div> 元素设置相同的类:

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    .cities {
        background-color:black;
        color:white;
        margin:20px;
        padding:20px;
    } 
    </style>
    </head>
    
    <body>
    
    <div class="cities">
    <h2>London</h2>
    <p>London is the capital city of England. 
    It is the most populous city in the United Kingdom, 
    with a metropolitan area of over 13 million inhabitants.</p>
    </div>
    
    <div class="cities">
    <h2>Paris</h2>
    <p>Paris is the capital and most populous city of France.</p>
    </div>
    
    <div class="cities">
    <h2>Tokyo</h2>
    <p>Tokyo is the capital of Japan, the center of the Greater Tokyo Area,
    and the most populous metropolitan area in the world.</p>
    </div>
    
    </body>
    </html>

    分类行内元素

    HTML <span> 元素是行内元素,能够用作文本的容器。

    设置 <span> 元素的类,能够为相同的 <span> 元素设置相同的样式。

    <!DOCTYPE html>
    <html>
    <head>
    <style>
      span.red {color:red;}
    </style>
    </head>
    <body>
    
    <h1>My <span class="red">Important</span> Heading</h1>
    
    </body>
    </html>
  • 相关阅读:
    Gin框架结合gorm实现mysql增删改查
    Gin框架安装使用
    Golang常用排序算法比较
    Golang获取时间戳及格式化
    Golang使用goroutine交替打印序列
    Golang基础编程(六)-并发编程
    Golang基础编程(五)-指针
    Golang基础编程(四)-Map(集合)、Slice(切片)、Range
    模块化前端开发入门指南(三)
    模块化前端开发入门指南(二)
  • 原文地址:https://www.cnblogs.com/marr/p/14901467.html
Copyright © 2011-2022 走看看