使用“订单”时,将2个Divs放在同一行上在flexbox中,无需调整HTML标记(CSS)而在您可以修改标记时

发布于 2025-01-23 17:39:10 字数 923 浏览 3 评论 0原文

我正在使用一个名为Divi Blog Extras的插件,该插件在CSS中使用“顺序”来定位DIV容器。我试图将两个Divs(.post-meta和.post类别)放在彼此之间,因为我已经纠正了订单,以便它与我的客户的设计相匹配,但是我正在努力使它们彼此相邻。

我尝试过浮标,内联风格和弯曲,但似乎没有任何影响它们的定位。看起来应该相对简单,但我无法按照应有的方式排队。

您是否有可以使用的建议( 绝对将其定位 - 除非这是唯一的方法)?

这是可以看到代码的演示网站(博客文章项目): https://miles.birdhouse-demos.com/blog/

这就是这个博客项目看起来像是开箱即用的: https://snipboard.io/hl5dqe.jpg

https://snipboard.io/izetmy.jpg

预先感谢您!

I'm using a plugin called Divi Blog Extras which is using "Order" in CSS to position DIV containers. I am attempting to put two divs (.post-meta and .post-categories) next to each other now that I've corrected the order so it matches my customer's designs, but I am struggling to get them next to each other.

I have tried floats, inline styles, and flexing, but nothing seems to affect how they position themselves. It looks like something that should be relatively straightforward yet I cannot get these to line up as they should.

Do you have any suggestions I could use (without absolutely positioning these - unless that's the only way)?

This is the DEMO website where to code can be seen (blog article item):
https://miles.birdhouse-demos.com/blog/

This is what this blog item looks like out of the box:
https://snipboard.io/hL5dqe.jpg

This is the goal based don't the client's designs:
https://snipboard.io/IZEtmY.jpg

Thank you in advance!

HTML MARKUP

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冷…雨湿花 2025-01-30 17:39:10

您可以将这两个项目都移至新的样式中,然后将它们并排放置

<div style="
  display: flex;
  justify-content: start;
">
  <p class="post-meta">...</p>
  <div class="post-categories">...</div>
</div>

You can move both of those items into a new and then style that div to position them side by side

<div style="
  display: flex;
  justify-content: start;
">
  <p class="post-meta">...</p>
  <div class="post-categories">...</div>
</div>
霓裳挽歌倾城醉 2025-01-30 17:39:10

好吧,您可以得到这个结果。
”在此处输入图像描述

进行以下操作:

p标记在div

<p class="post-meta"> <span class="read-time"><span class="et-pb-icon"></span>2 min read</span></p>

<div class="post-categories"><a href="https://miles.birdhouse-demos.com/category/mental-health/" target="_self" rel="category term tag" class="el_category_term el_term_mental-health">Mental Health</a></div>

<div class="post-categories"><a href="https://miles.birdhouse-demos.com/category/mental-health/" target="_self" rel="category term tag" class="el_category_term el_term_mental-health">Mental Healthggg</a>|<p class="post-meta"><span class="read-time"><span class="et-pb-icon"></span>2 min read</span></p></div>

categories {
    width: 48%!important;
    padding: 0!important;


.et_pb_post_extra.el_dbe_block_extended .post-meta {
    border-top: none;
    padding: 10px 0 0 5px!important;

}

categories {
    width: 100%!important;
    padding: 0!important;


.et_pb_post_extra.el_dbe_block_extended .post-meta {
    border-top: none;
    padding: 10px 0 0 5px!important;
    display:inline;

}

Well you can get this result.
enter image description here

By doing the following:

Put the p tag inside the div.
From this:

<p class="post-meta"> <span class="read-time"><span class="et-pb-icon"></span>2 min read</span></p>

<div class="post-categories"><a href="https://miles.birdhouse-demos.com/category/mental-health/" target="_self" rel="category term tag" class="el_category_term el_term_mental-health">Mental Health</a></div>

To this:

<div class="post-categories"><a href="https://miles.birdhouse-demos.com/category/mental-health/" target="_self" rel="category term tag" class="el_category_term el_term_mental-health">Mental Healthggg</a>|<p class="post-meta"><span class="read-time"><span class="et-pb-icon"></span>2 min read</span></p></div>

And changing some styles, from this:

categories {
    width: 48%!important;
    padding: 0!important;


.et_pb_post_extra.el_dbe_block_extended .post-meta {
    border-top: none;
    padding: 10px 0 0 5px!important;

}

To this:

categories {
    width: 100%!important;
    padding: 0!important;


.et_pb_post_extra.el_dbe_block_extended .post-meta {
    border-top: none;
    padding: 10px 0 0 5px!important;
    display:inline;

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文