inline-block图文布局

本文通过三个不同的示例展示了如何使用inline-block属性进行网页布局。包括使用span标签、img标签以及flex布局实现元素的水平排列,并保持垂直居中对齐。
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>inline-block使用</title>
    <style>
        :not(input, textarea) {
            -webkit-user-select: none;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            -webkit-touch-callout: none;
            -webkit-text-size-adjust: none;
        }

        html,
        body,
        div,
        span,
        applet,
        object,
        iframe,
        h1,
        h2,
        h3,
        h4,
        h5,
        h6,
        p,
        blockquote,
        pre,
        a,
        abbr,
        acronym,
        address,
        big,
        cite,
        code,
        del,
        dfn,
        em,
        font,
        ins,
        kbd,
        q,
        s,
        samp,
        small,
        strike,
        strong,
        sub,
        sup,
        tt,
        var,
        dl,
        dt,
        dd,
        ol,
        ul,
        li,
        fieldset,
        form,
        label,
        legend,
        table,
        caption,
        tbody,
        tfoot,
        thead,
        tr,
        th,
        td {
            border: 0;
            font-family: "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", arial, Tahoma, SimSun, sans-serif;
            font-style: inherit;
            font-weight: inherit;
            margin: 0;
            outline: 0;
            padding: 0;
            vertical-align: baseline
        }

        html {
            font-size: 50px;
            height: 100%
        }

        .demo {
            margin: .3rem;
        }

        .demo .row {
            font-size: 0;
        }

        .demo .row span {
            display: inline-block;
            vertical-align: middle;
            height: .4rem;
        }

        .demo .ico {
            width: 0.4rem;
            background: url(http://static.58.com/lbg/personcenter/dist/images/shop@2x.png) no-repeat center;
            background-size: 100%;
            margin-right: 0.2rem;
        }

        .demo .company {
            font-size: 0.26rem;
            color: #333333;
            letter-spacing: 0;
            margin-right: 0.1rem;
        }

        .demo .arrow {
            height: .22rem !important;
            width: .22rem;
            background: url(http://static.58.com/lbg/personcenter/dist/images/shoparrow@3x.png) no-repeat top center;
            background-size: 100%;
        }

        .demo .calltime {
            font-size: 0.26rem;
            color: #333333;
            float: right;
        }

        .demo1 span,
        .demo1 img {
            vertical-align: middle;
            outline: .01rem solid red;
        }

        .demo1 {
            margin: .3rem;
        }

        .demo1 .row {
            font-size: 0;
            outline: .01rem solid green;
        }

        .demo1 .ico {
            height: .4rem;
            width: .4rem;
        }

        .demo1 .company {
            font-size: 0.26rem;
            color: #333333;
            margin-right: 0.1rem;
        }

        .demo1 .arrow {
            height: .22rem !important;
            width: .22rem;
        }

        .demo1 .calltime {
            font-size: 0.26rem;
            color: #333333;
            float: right;
        }

        .demo2 {
            margin: .3rem;
        }

        .demo2 .row {
            display: flex;
            align-items: center;
            font-size: 0;
            outline: .01rem solid green;
        }

        .demo2 img,
        .demo2 span {
            outline: .01rem solid red;
        }

        .demo2 .ico {
            height: .4rem;
            width: .4rem;
        }

        .demo2 .company {
            font-size: 0.26rem;
            color: #333333;
            margin-right: 0.1rem;
        }

        .demo2 .arrow {
            height: .22rem;
            width: .22rem;
        }

        .demo2 .calltime {
            font-size: 0.26rem;
            color: #333333;
        }

        .demo3 {
            margin: .3rem;
        }

        .demo3 .row {
            font-size: 0;
            padding:.2rem 0;
            background:#f3f3f3;
            margin-bottom:.2rem;
        }

        .demo3 .row .shop {
            font-size: 0.26rem;
            color: #333333;
            text-decoration: none;
        }

        .demo3 .row .shop::before {
            content: '';
            display: inline-block;
            vertical-align: -.1rem;
            width: .4rem;
            height: .4rem;
            background: url(http://static.58.com/lbg/personcenter/dist/images/shop@2x.png) no-repeat;
            background-position: top left;
            background-size: 100%;
            margin-right: .2rem;
        }

        .demo3 .row .shop::after {
            content: '';
            display: inline-block;
            vertical-align: middle;
            width: .22rem;
            height: .22rem;
            background: url(http://static.58.com/lbg/personcenter/dist/images/shoparrow@3x.png) no-repeat;
            background-position: top left;
            background-size: 100%;
            margin-left: .1rem;
        }

        .demo3 .row .calltime {
            float: right;
            font-size: 0.26rem;
            color: #333333;
        }
    </style>
</head>

<body>
    <div class="demo">
        <div class="row">
            <span class="ico"></span>
            <span class="company">该商家暂无店铺</span>
            <span class="arrow"></span>
            <span class="calltime">通话时长2分28秒</span>
        </div>
        <div class="row">
            <span class="ico"></span>
            <span class="company">该商家暂无店铺</span>
            <span class="arrow"></span>
            <span class="calltime">通话时长2分28秒</span>
        </div>
        <div class="row">
            <span class="ico"></span>
            <span class="company">该商家暂无店铺</span>
            <span class="arrow"></span>
            <span class="calltime">通话时长2分28秒</span>
        </div>
    </div>
    <div class="demo1">
        <div class="row">
            <img class="ico" src="http://static.58.com/lbg/personcenter/dist/images/shop@2x.png" alt="">
            <span class="company">该商家暂无店铺</span>
            <img class="arrow" src="http://static.58.com/lbg/personcenter/dist/images/shoparrow@3x.png" alt="">
            <span class="calltime">通话时长2分28秒</span>
        </div>
        <div class="row">
            <img class="ico" src="http://static.58.com/lbg/personcenter/dist/images/shop@2x.png" alt="">
            <span class="company">该商家暂无店铺</span>
            <img class="arrow" src="http://static.58.com/lbg/personcenter/dist/images/shoparrow@3x.png" alt="">
            <span class="calltime">通话时长2分28秒</span>
        </div>
        <div class="row">
            <img class="ico" src="http://static.58.com/lbg/personcenter/dist/images/shop@2x.png" alt="">
            <span class="company">该商家暂无店铺</span>
            <img class="arrow" src="http://static.58.com/lbg/personcenter/dist/images/shoparrow@3x.png" alt="">
            <span class="calltime">通话时长2分28秒</span>
        </div>
    </div>
    <div class="demo2">
        <div class="row">
            <img class="ico" src="http://static.58.com/lbg/personcenter/dist/images/shop@2x.png" alt="">
            <span class="company">该商家暂无店铺</span>
            <img class="arrow" src="http://static.58.com/lbg/personcenter/dist/images/shoparrow@3x.png" alt="">
            <span class="calltime">通话时长2分28秒</span>
        </div>
        <div class="row">
            <img class="ico" src="http://static.58.com/lbg/personcenter/dist/images/shop@2x.png" alt="">
            <span class="company">该商家暂无店铺</span>
            <img class="arrow" src="http://static.58.com/lbg/personcenter/dist/images/shoparrow@3x.png" alt="">
            <span class="calltime">通话时长2分28秒</span>
        </div>
        <div class="row">
            <img class="ico" src="http://static.58.com/lbg/personcenter/dist/images/shop@2x.png" alt="">
            <span class="company">该商家暂无店铺</span>
            <img class="arrow" src="http://static.58.com/lbg/personcenter/dist/images/shoparrow@3x.png" alt="">
            <span class="calltime">通话时长2分28秒</span>
        </div>
    </div>
    <div class="demo3">
        <div class="row">
            <a class="shop" href="http://m.58.com">该商家暂无店铺</a>
            <span class="calltime">通话时长2分28秒</span>
        </div>
        <div class="row">
            <a class="shop" href="http://m.58.com">该商家暂无店铺</a>
            <span class="calltime">通话时长2分28秒</span>
        </div>
    </div>
</body>

</html>

 

转载于:https://www.cnblogs.com/Dylanblogs/p/8575547.html

内容概要:本文系统介绍了算术优化算法(AOA)的基本原理、核心思想及Python实现方法,并通过图像分割的实际案例展示了其应用价值。AOA是一种基于种群的元启发式算法,其核心思想来源于四则运算,利用乘除运算进行全局勘探,加减运算进行局部开发,通过数学优化器加速函数(MOA)和数学优化概率(MOP)动态控制搜索过程,在全局探索与局部开发之间实现平衡。文章详细解析了算法的初始化、勘探与开发阶段的更新策略,并提供了完整的Python代码实现,结合Rastrigin函数进行测试验证。进一步地,以Flask框架搭建前后端分离系统,将AOA应用于图像分割任务,展示了其在实际工程中的可行性与高效性。最后,通过收敛速度、寻优精度等指标评估算法性能,并提出自适应参数调整、模型优化和并行计算等改进策略。; 适合人群:具备一定Python编程基础和优化算法基础知识的高校学生、科研人员及工程技术人员,尤其适合从事人工智能、图像处理、智能优化等领域的从业者;; 使用场景及目标:①理解元启发式算法的设计思想与实现机制;②掌握AOA在函数优化、图像分割等实际问题中的建模与求解方法;③学习如何将优化算法集成到Web系统中实现工程化应用;④为算法性能评估与改进提供实践参考; 阅读建议:建议读者结合代码逐行调试,深入理解算法流程中MOA与MOP的作用机制,尝试在不同测试函数上运行算法以观察性能差异,并可进一步扩展图像分割模块,引入更复杂的预处理或后处理技术以提升分割效果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值