I got this exact question in an email the other day, and I thought it would make a nice blog post because of how wonderfully satisfying this is to do in CSS these days. Plus we can sprinkle in polish to it as we go.
HTML-wise, I’m thinking image, text, image, text, etc.
<img src="/static/imghwm/default1.png" data-src="您如何制作一个图片,并在页面的一侧与另一侧的段落相匹配?" class="lazy" alt="您如何制作一个图片,并在页面的一侧与另一侧的段落相匹配?" height="" style="max-width:90%"> <p>Text text text您如何制作一个图片,并在页面的一侧与另一侧的段落相匹配?</p> <img src="/static/imghwm/default1.png" data-src="您如何制作一个图片,并在页面的一侧与另一侧的段落相匹配?" class="lazy" alt="您如何制作一个图片,并在页面的一侧与另一侧的段落相匹配?" height="" style="max-width:90%"> <p>Text text text您如何制作一个图片,并在页面的一侧与另一侧的段落相匹配?</p> <img src="/static/imghwm/default1.png" data-src="您如何制作一个图片,并在页面的一侧与另一侧的段落相匹配?" class="lazy" alt="您如何制作一个图片,并在页面的一侧与另一侧的段落相匹配?" height="" style="max-width:90%"> <p>Text text text您如何制作一个图片,并在页面的一侧与另一侧的段落相匹配?</p>
If that was our entire body in an HTML document, the answer to the question in the blog post title is literally two lines of CSS:
body { display: grid; grid-template-columns: min-content 1fr; }
It’s going to look something like this…
So cool. Thanks CSS. But let’s clean it up. Let’s make sure there is a gap, set the default type, and reign in the layout.
body { display: grid; padding: 2rem; grid-template-columns: 300px 1fr; gap: 1rem; align-items: center; max-width: 800px; margin: 0 auto; font: 500 100%/1.5 system-ui; } img { max-width: 100%; height: auto; }
I mean… ship it, right? Close, but maybe we can just add a quick mobile style.
@media (max-width: 650px) { body { display: block; font-size: 80%; } p { position: relative; margin: -3rem 0 2rem 1rem; padding: 1rem; background: rgba(white, 0.8); } }
OK, NOW ship it!
以上是您如何制作一个图片,并在页面的一侧与另一侧的段落相匹配?的详细内容。更多信息请关注PHP中文网其他相关文章!

在本周的综述中:datepickers正在让键盘用户头痛,一个新的Web组件编译器,有助于与Fouc进行战斗,我们终于获得了造型列表项目标记,以及在您的网站上获得网络攻击的四个步骤。

在本周的Web平台新闻世界中,Google搜索控制台可以更轻松地查看爬行的标记,我们了解到自定义属性


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

螳螂BT
Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具

Atom编辑器mac版下载
最流行的的开源编辑器