H2 浮动和动态 Div
大家好,这是有问题的网站:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为什么不直接从 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...
试试这个:
Try this:
我能想到的 atm 的最好方法是每次当标题太长并且您正在使用 .clip <_< 时,手动向此 h2 添加新类。
像这样的东西:
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: