html - 描述 html 和 css 的格式

标签 html css

我希望我的描述是这样的,我可以用边距、 float 和宽度来完成,但如果我这样做并调整分辨率大小,它将是一个困惑的布局。 那么您认为我还需要使用什么其他方法?

[IMG1 | description text  | [IMG2
 IMG1 | description text  |  IMG2
 IMG1 |  text text text   |  IMG2
IMG1] |     text text     |  IMG2]

HTML

<div class="headbapt">
    <img class="bapt" src="images/baptismal.jpg">Sacrament of Baptism is the first step in a lifelong journey of commitment and discipleship. Whether we are baptized as infants or adults, Baptism is the Church's way of celebrating and enacting the embrace of God.
    <img class="bapt2" src="images/baptismal.jpg">
</div>

CSS

.headbapt {
     text-align:center;
}
.baptdesc {
    width: 295px;
    margin-left: 40%;
}
.bapt {
    float: left;
    margin-left: 35%;
}
.bapt2 {
    float: right;
    margin-right: 32.5%;
    margin-top: -8.5%;
}

最佳答案

你为什么要使用 3 个 div。第一个和最后一个 div 给出左右浮动和中间 div float:left

        <div class="descr">
            <div class="leftimg">
                <img class="bapt2" src="images/baptismal.jpg">
             </div>
             <div class="text">

              </div>
             <div class="rightimg">
                <img class="bapt2" src="images/baptismal.jpg">
              </div>
        </div>

关于html - 描述 html 和 css 的格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24697372/

相关文章:

Jquery 和 HTML FormData 返回 "Uncaught TypeError: Illegal invocation"

javascript - 如何加速html5游戏

html - 固定的 div 位于另一个 div 之上

html - 替代 "-webkit-backface-visibility:hidden"以停止闪烁

javascript - 将唯一 ID 传递给 Javascript 以进行水平滚动

javascript - 如何在不闪烁的情况下缩放+滚动JavaScript

javascript - 在指定位置弹出

html - 如何删除输入类型中的默认颜色?

javascript - HTML5 音频 'trigger play' 在 iPad 上不工作

Javascript 登场——从 Chrome 控制台到小书签