HTML_CSS学习:浮动

一、浮动简介

相关代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>浮动_简介</title>
    <style>
        div{
            width: 600px;
            height: 400px;
            background-color: #1c80d9;
        }
        img{
            float: right;
            /*margin-right: 0.5em;*/
        }
        .test::first-letter{
            font-size: 80px;
            float: left;
        }

    </style>
</head>
<body>
    <div>
        <img src="../pictures/喜羊羊.jpg" alt="" style="width: 200px;height: auto;">
        lorem ipsum dolor sit amet, consectetur adipisicing elit. Quisquam, quod.
        lorem ipsum dolor sit amet, consectetur adipisicing elit. Quisquam, quod.
        lorem ipsum dolor sit amet, consectetur adipisicing elit. Quisquam, quod.
        lorem ipsum dolor sit amet, consectetur adipisicing elit. Quisquam, quod.
        lorem ipsum dolor sit amet, consectetur adipisicing elit. Quisquam, quod.
        lorem ipsum dolor sit amet, consectetur adipisicing elit. Quisquam, quod.
        lorem ipsum dolor sit amet, consectetur adipisicing elit. Quisquam, quod
        lorem ipsum dolor sit amet, consectetur adipisicing elit. Quisquam, quod.
        lorem ipsum dolor sit amet, consectetur adipisicing elit. Quisquam, quod.
        lorem ipsum dolor sit amet, consectetur adipisicing elit. Quisquam, quod.
        lorem ipsum dolor sit amet, consectetur adipisicing elit. Quisquam, quod.
    </div>
    <hr>
    <div class="test">
        The quick brown fox jumps over the lazy dog, while the eager beaver builds a sturdy dam and the proud peacock displays its vibrant plumage. A clever crow steals a shiny ring from the sleeping cat, as the noisy crowders chatter in the bustling city square. The brave knight slays the fearsome dragon with his trusty sword, and the joyful children play in the sunny meadow. The graceful swan glides on the serene lake, while the mischievous monkey swings from tree to tree. The diligent bee collects nectar from the colorful flowers, as the majestic eagle soars high in the clear blue sky. The talented artist captures the beauty of nature on her canvas, and the wise owl watches over the peaceful forest. The ambitious entrepreneur launches a successful startup, while the skillful chef prepares a delicious feast for the hungry guests. The curious kitten explores its new surroundings, as the faithful dog guards its owner’s home.
    </div>

</body>
</html>

显示结果:

二、元素浮动后的特点

相关代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>元素浮动后的特点</title>
    <style>
        .outer{
            width: 800px;
            height: 400px;
            padding: 10px;
            background-color: #5dcd2d;
            text-align: center;
        }
        .box{
            font-size: 20px;
            padding: 10px;
        }
        .box1{
            background-color: red;
        }
        .box2{
            background-color: blue;
            float: left;
            /*width: 200px;*/
            /*height: 200px;*/
        }
        .box3{
            background-color: yellow;
            float: left;
        }
    </style>
</head>
<body>
    <div class="outer">
        <div class = "box box1">盒子1</div>
        <div class = "box box2">盒子2</div>
        <div class = "box box3">盒子3</div>

    </div>

</body>
</html>

显示结果:

三、浮动小练习

相关代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>浮动小练习</title>
    <style>
        .outer{
            width: 500px;
            background-color: #47c447;
            border: 1px solid black;
        }
        .box{
            width: 200px;
            height: 200px;
            background-color: red;
            border: 1px solid black;
            margin: 10px;
            float: left;
        }
        .box1{
            height: 230px;
        }
        /*.box1{*/
        /*    float: left;*/
        /*}*/
    </style>
</head>
<body>
    <div class="outer">
        <div class = "box box1">1</div>
        <div class = "box box2">2</div>
        <div class = "box box3">3</div>
    </div>
    <div style="background-color: #999ff0">The quick brown fox jumps over the lazy dog, while the eager beaver builds a sturdy dam and the proud peacock displays its vibrant plumage. A clever crow steals a shiny ring from the sleeping cat, as the noisy crowders chatter in the bustling city square. The brave knight slays the fearsome dragon with his trusty sword, and the joyful children play in the sunny meadow. </div>

</body>
</html>

显示结果:

四、浮动后的影响

相关代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>浮动后的影响</title>
    <style>
        .outer{
            width: 500px;
            background-color: #47c447;
            border: 1px solid black;
        }
        .box{
            width: 100px;
            height: 100px;
            background-color: red;
            border: 1px solid black;
            margin: 10px;
            /*float: left;*/
        }
        .box1,.box2,.box3{
            float: left;
        }

    </style>
</head>
<body>
    <div class="outer">
        <div class="box box0">0</div>
        <div class="box box1">1</div>
        <div class="box box2">2</div>
        <div class="box box3">3</div>
<!--        <div class="box box4">4</div>-->

    </div>
<!--    <div style="background-color: #999ff0">The quick brown fox jumps over the lazy dog, while the eager beaver builds a sturdy dam and the proud peacock displays its vibrant plumage. A clever crow steals a shiny ring from the sleeping cat, as the noisy crowders chatter in the bustling city square. The brave knight slays the fearsome dragon with his trusty sword, and the joyful children play in the sunny meadow. The graceful swan glides on the serene lake, while the mischievous monkey swings from tree to tree. The diligent bee collects nectar from the colorful flowers, as the majestic eagle soars high in the clear blue sky. The talented artist captures the beauty of nature on her canvas, and the wise owl watches over the peaceful forest. The ambitious entrepreneur launches a successful startup, while the skillful chef prepares a delicious feast for the hungry guests. The curious kitten explores its new surroundings, as the faithful dog guards its owner’s home. The powerful ocean waves crash against the rocky shore, and the gentle breeze whispers through the leaves of the ancient trees. The adventurous traveler explores remote villages in search of hidden treasures, while the playful dolphin leaps through the waves of the vast ocean. </div>-->

</body>
</html>

显示结果:

五、解决浮动后的影响

相关代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>解决浮动后的影响</title>
    <style>
        .outer{
            width: 500px;
            background-color: #47c447;
            border: 1px solid black;
            /*第一种解决方案*/
            /*height: 122px;*/
            /*第二种解决方案*/
            /*float: left;*/
            /*第三种解决方案*/
            /*overflow: scroll;*/
        }

        .box{
            width: 100px;
            height: 100px;
            background-color: red;
            border: 1px solid black;
            margin: 10px;
            /*float: left;*/
        }
        .box1,.box2,.box3,.box4{
            float: left;
        }
        /*.box4{*/
        /*    !*display: inline-block;*!*/
        /*    !*height: 260px;*!*/
        /*    !*clear: left;*!*/
        /*    display: inline;*/
        /*    clear: both;*/
        /*    !*消除左侧浮动兄弟带来的影响*!*/
        /*}*/
        .box5{
            clear:both;
        }
        .mofa{
            /*第四种*/
            clear: both;
        }
        .outer::after{
            content: '';
            display: block;
            clear: both;
        }

    </style>
</head>
<body>
    <div class="outer">
<!--        <div class="box box0">0</div>-->
        <div class="box box1">1</div>
        <div class="box box2">2</div>
        <div class="box box3">3</div>
        <div class="box box4">4</div>
        <div class="box box5">5</div>
<!--        <div class="box box5">5</div>-->
<!--        <div class="mofa"></div>-->

    </div>
    <div style="background-color: #999ff0">The quick brown fox jumps over the lazy dog, while the eager beaver builds a sturdy dam and the proud peacock displays its vibrant plumage. A clever crow steals a shiny ring from the sleeping cat, as the noisy crowders chatter in the bustling city square. The brave knight slays the fearsome dragon with his trusty sword, and the joyful children play in the sunny meadow. The graceful swan glides on the serene lake, while the mischievous monkey swings from tree to tree. The diligent bee collects nectar from the colorful flowers, as the majestic eagle soars high in the clear blue sky. The talented artist captures the beauty of nature on her canvas, and the wise owl watches over the peaceful forest. The ambitious entrepreneur launches a successful startup, while the skillful chef prepares a delicious feast for the hungry guests. The curious kitten explores its new surroundings, as the faithful dog guards its owner’s home. The powerful ocean waves crash against the rocky shore, and the gentle breeze whispers through the leaves of the ancient trees. The adventurous traveler explores remote villages in search of hidden treasures, while the playful dolphin leaps through the waves of the vast ocean. </div>

</body>
</html>

显示结果:

六、浮动布局小练习

相关代码:

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>浮动布局小练习</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .leftfix{
            float: left;
        }
        .rightfix{
            float: right;
        }
        .clearfix::after{
            content: '';
            display: block;
            clear: both;
        }
        .container{
            width: 960px;
            margin: 0 auto;
            text-align: center;
        }
        .logo{
            width: 200px;

        }
        .banner1{
            width: 540px;
            /*margin-left: 20px;*/
            /*margin-right: 20px;*/
            margin: 0 10px;

        }
        .banner2{
            width: 200px;
        }
        .logo,.banner1,.banner2{
            height: 80px;
            line-height: 80px;
            background-color: #c9c9c9;

        }
        .meun{
            height: 30px;
            background-color: #c9c9c9;
            margin-top: 10px;

        }
        .item1,.item2{
            width: 368px;
            height: 198px;
            line-height: 198px;
            border: 1px solid #000;
            margin-right: 10px;
        }
        .content{
            margin-top: 10px;
        }
        .item3,.item4,.item5,.item6{
            width: 178px;
            height: 198px;
            line-height: 198px;
            border: 1px solid #000;
            margin-right: 10px;
        }
        .bottom{
            margin-top: 10px;
        }
        .item7,.item8,.item9{
            width: 198px;
            height: 128px;
            line-height: 128px;
            border: 1px solid #000;
        }
        .item8{
            margin: 10px 0;
        }
        .footer{
            height: 60px;
            background-color: #c9c9c9;
            line-height: 60px;
            margin-top: 10px;
        }
    </style>
</head>
<body>
    <div class="container">
<!--        头部-->
        <div class="page-header clearfix">
            <div class="logo leftfix">logo</div>
            <div class="banner1 leftfix">banner1</div>
            <div class="banner2 leftfix">banner2</div>

        </div>
<!--        菜单-->
        <div class="meun">菜单</div>
<!--        内容区-->
        <div class="content clearfix">
            <div class="left leftfix">
<!--                上-->
               <div class="top clearfix">
                   <div class="item1 leftfix">栏目一</div>
                   <div class="item2 leftfix">栏目二</div>
               </div>
<!--                下-->
               <div class="bottom">
                   <div class="item3 leftfix">栏目三</div>
                   <div class="item4 leftfix">栏目四</div>
                   <div class="item5 leftfix">栏目五</div>
                   <div class="item6 leftfix">栏目六</div>

               </div>
            </div>
            <div class="right rightfix">
                <div class="item7">栏目七</div>
                <div class="item8">栏目八</div>
                <div class="item9">栏目九</div>
            </div>
        </div>
<!--        页脚-->
        <div class="footer">页脚</div>
    </div>

</body>
</html>

显示结果:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/592615.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

c++多线程基础

简介 c多线程基础需要掌握这三个标准库&#xff1a;std::thread, std::mutex, and std::async。 1. Hello, world #include <iostream> #include <thread>void hello() { std::cout << "Hello Concurrent World!\n"; }int main() {std::thread…

如何获得 FHE Circuit Privacy

参考文献&#xff1a; [AJL12] Asharov G, Jain A, Lpez-Alt A, et al. Multiparty computation with low communication, computation and interaction via threshold FHE[C]. EUROCRYPT 2012: 483-501[DS16] Ducas L, Stehl D. Sanitization of FHE Ciphertexts[C]. EUROCRY…

连接和使用vCenter Server嵌入式vPostgres数据库

vCenter Server 早期支持内嵌(embedded)和外部(external)数据库,内嵌数据库就是vPostgres,基于VMware Postgres数据库(PostgreSQL数据库),外部数据库用的多的是Oracle数据库和SQL Server数据库。因为早期使用内嵌的PostgreSQL数据库只能用于小型环境,比如仅支持几十台…

EPAI手绘建模APP颜色、贴图、材质、样式

⑦ 颜色选择页面 1) 颜色环选色。 图 65 颜色选择器-颜色环 2) RGB选色。 图 66 颜色选择器-RGB 3) HSL选色。 图 67 颜色选择器-HSL 4) 国风颜色库选色。 图 68 颜色选择器-国风 5) CSS颜色库选色。 图 69 颜色选择器-CSS 6) 历史颜色&#xff1a;保存最近使用的多个颜色&…

Python设计模式 - 单例模式

定义 单例模式是一种创建型设计模式&#xff0c; 其主要目的是确保一个类只有一个实例&#xff0c; 并提供一个全局访问点来访问该实例。 结构 应用场景 资源管理&#xff1a;当需要共享某个资源时&#xff0c;例如数据库连接、线程池、日志对象等&#xff0c;可以使用单例模…

电路板/硬件---器件

电阻 电阻作用 电阻在电路中扮演着重要的角色&#xff0c;其作用包括&#xff1a; 限制电流&#xff1a;电阻通过阻碍电子流动的自由而限制电流。这是电阻最基本的功能之一。根据欧姆定律&#xff0c;电流与电阻成正比&#xff0c;电阻越大&#xff0c;通过电阻的电流就越小。…

OpenCV(六) —— Android 下的人脸识别

本篇我们来介绍在 Android 下如何实现人脸识别。 上一篇我们介绍了如何在 Windows 下通过 OpenCV 实现人脸识别&#xff0c;实际上&#xff0c;在 Android 下的实现的核心原理是非常相似的&#xff0c;因为 OpenCV 部分的代码改动不大&#xff0c;绝大部分代码可以直接移植到 …

Pytorch: nn.Embedding

文章目录 1. 本质2. 用Embedding产生一个10 x 5 的随机词典3. 用这个词典编码两个简单单词4. Embedding的词典是可以学习的5. 例子完整代码 1. 本质 P y t o r c h \mathrm{Pytorch} Pytorch 的 E m b e d d i n g \mathrm{Embedding} Embedding 模块是一个简单的查找表&#…

【多变量控制系统 Multivariable Control System】(3)系统的状态空间模型至转换方程模型(使用Python)【新加坡南洋理工大学】

一、转换式 二、系统的状态空间模型 由矩阵A, B, C, D给出&#xff1a; 三、由状态空间模型转化为转换方程模型 函数原型&#xff08;版权所有&#xff1a;scipy&#xff09;&#xff1a; def ss2tf(A, B, C, D, input0):r"""State-space to transfer functi…

【netty系列-03】深入理解NIO的基本原理和底层实现(详解)

Netty系列整体栏目 内容链接地址【一】深入理解网络通信基本原理和tcp/ip协议https://zhenghuisheng.blog.csdn.net/article/details/136359640【二】深入理解Socket本质和BIOhttps://zhenghuisheng.blog.csdn.net/article/details/136549478【三】深入理解NIO的基本原理和底层…

SpringCloud Alibaba Nacos简单应用(三)

文章目录 SpringCloud Alibaba Nacos创建Nacos 的服务消费者需求说明/图解创建member-service-nacos-consumer-80 并注册到NacosServer8848创建member-service-nacos-consumer-80修改pom.xml创建application.yml创建主启动类业务类测试 SpringCloud Alibaba Nacos 创建Nacos 的…

鸿蒙通用组件Image简介

鸿蒙通用组件Image简介 图片----Image图片支持三种引用方式设置图片宽高设置图片缩放模式设置图片占位图设置图片重复样式设置图片插值效果 图片----Image Image主要用于在应用中展示图片 Image($r(app.media.app_icon)).width(150) // 设置宽.height(150) // 设置高.objectF…

使用docker-compose编排lnmp(dockerfile)完成wordpress

文章目录 使用docker-compose编排lnmp&#xff08;dockerfile&#xff09;完成wordpress1、服务器环境2、Docker、Docker-Compose环境安装2.1 安装Docker环境2.2 安装Docker-Compose 3、nginx3.1 新建目录&#xff0c;上传安装包3.2 编辑Dockerfile脚本3.3 准备nginx.conf配置文…

redis集群-主从机连接过程

首先从机需要发送自身携带的replid和offset向主机请求连接 replid&#xff1a;replid是所有主机在启动时会生成的一个固定标识&#xff0c;它表示当前复制流的id&#xff0c;当从机第一次请求连接时&#xff0c;主机会将自己的replid发送给从机&#xff0c;从机在接下来的请求…

docker部署nginx并配置https

1.准备SSL证书&#xff1a; 生成私钥&#xff1a;运行以下命令生成一个私钥文件。 生成证书请求&#xff08;CSR&#xff09;&#xff1a;运行以下命令生成证书请求文件。 生成自签名证书&#xff1a;使用以下命令生成自签名证书。 openssl genrsa -out example.com.key 2048 …

【Java探索之旅】内部类 静态、实例、局部、匿名内部类全面解析

文章目录 &#x1f4d1;前言一、内部类1.1 概念1.2 静态内部类1.3 实例内部类1.4 局部内部类1.5 匿名内部类 &#x1f324;️全篇总结 &#x1f4d1;前言 在Java编程中&#xff0c;内部类是一种强大的特性&#xff0c;允许在一个类的内部定义另一个类&#xff0c;从而实现更好的…

Vue3-element-plus表格

一、element-plus 1.用组件属性实现跳转路由 <el-menu active-text-color"#ffd04b" background-color"#232323" :default-active"$route.path" //高亮 text-color"#fff"router><el-menu-item index"/article/channe…

第十篇:深入文件夹:Python中的文件管理和自动化技术

深入文件夹&#xff1a;Python中的文件管理和自动化技术 1 文件系统基础操作 在今天的技术博客中&#xff0c;我们将深入探讨Python中的文件系统基础操作。文件系统对于任何操作系统都是不可或缺的组成部分&#xff0c;它管理着数据的存储、检索以及维护。Python通过其标准库中…

节能洗车房车牌识别项目实战

项目背景 学电子信息的你加入了一家节能环保企业&#xff0c;公司的主营产品是节能型洗车房。由于节水节电而且可自动洗车&#xff0c;产品迅速得到了市场和资本的认可。公司决定继续投入研发新一代产品&#xff1a;在节能洗车房的基础上实现无人值守的功能。新产品需要通过图…

Java高阶私房菜:JVM性能优化案例及讲解

目录 核心思想 优化思考方向 压测环境准备 堆大小配置调优 调优前 调优后 分析结论 垃圾收集器配置调优 调优前 调优后 分析结论 JVM性能优化是一项复杂且耗时的工作&#xff0c;该环节没办法一蹴而就&#xff0c;它需要耐心雕琢&#xff0c;逐步优化至理想状态。“…
最新文章