H2 浮动和动态 Div

发布于 2024-08-04 03:54:57 字数 536 浏览 3 评论 0原文

大家好,这是有问题的网站:

http://www.myvintagesecret.com/

我有一个首页上有一堆帖子。 H2 标签中的标头。除此之外,有时我还会有一个名为 Clip 的 div。如果那里有 .clip div,我希望标题换行到下一行。

我的问题是,如果有一个 .clip div 并且有足够长的标题,它就会使 .clip div 下降。我希望 H3 能够换行并且 .clip 看起来像第 1 篇文章。

    .clip {
    width:214px;
    height:275px;
    float:right;
    }

        #content h2 {
    color:#1A1A1A;
    float:left;
    font-size:20px;
    margin-left:30px;
    padding:70px 0 2px 0;
}

Hey everyone, here is the site in question:

http://www.myvintagesecret.com/

I have a bunch of posts on the front page. The header in in a H2 tag. Beside that, I will sometimes have a div called Clip. I want the title to wrap onto the next line IF there is a .clip div there.

My problem is that IF there is a .clip div AND there is a long enough title, it bumps the .clip div down. I want H3 to wrap and .clip to look like the 1st post.

    .clip {
    width:214px;
    height:275px;
    float:right;
    }

        #content h2 {
    color:#1A1A1A;
    float:left;
    font-size:20px;
    margin-left:30px;
    padding:70px 0 2px 0;
}

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

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

发布评论

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

评论(3

季末如歌 2024-08-11 03:54:57

为什么不直接从 h2 中删除 float:left 呢?

编辑:并确保剪辑出现在 html 中的 h2 之前...

Why don't you just remove the float:left from the h2?

Edit: and make sure that the clip appears before the h2 in the html...

梦晓ヶ微光ヅ倾城 2024-08-11 03:54:57

试试这个:

#content h2 {
    color:#1A1A1A;
    float:left;
    font-size:20px;
    line-height:180%;
    margin-left:30px;
    max-width:335px;
    padding:70px 0 2px;
}

Try this:

#content h2 {
    color:#1A1A1A;
    float:left;
    font-size:20px;
    line-height:180%;
    margin-left:30px;
    max-width:335px;
    padding:70px 0 2px;
}
遮了一弯 2024-08-11 03:54:57

我能想到的 atm 的最好方法是每次当标题太长并且您正在使用 .clip <_< 时,手动向此 h2 添加新类。

像这样的东西:

.fix{
    line-height:180% !important;
    width:336px !important;
}

The best way i can think of atm is to manually add new class to this h2 everytime when title is too long and you are using that .clip <_<

Something like this:

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