简体   繁体   中英

how can I make two successive “div” tags not “bleed” into each other?

I have two divs:

<div style="height:30px; font-weight:bold" align="center">
  <div class = 'membership_description'>
   stuff here, nested <div> etc.
  </div>

 <div style="height:30px; font-weight:bold" align="center">Using Coupon &amp;quot;special-current&amp;quot; - Special access just for current members</div>

For some reason, the second div ends up appearing in the middle of all the stuff under the first div.

I tried 'display: block' for the first div but no love, ideas?

I think I see part of the problem -- there is this inline style -- when I remove "height" from Google Chrome, it becomes normal. But I don't have access to that, only css...can I override?

The most likely cause of this is that you aren't clearing your floats properly for your inner nested divs. Try adding overflow: auto to .membership_description .

在嵌套的divs下添加<div style="clear: both"></div>

Try using float:left; or float:right; for both divs, this way they shouldnt overlap each other. You can also try <div style="clear: both"></div> of course.

I think I see part of the problem -- there is this inline style -- when I remove "height" from Google Chrome, it becomes normal. But I don't have access to that, only css...can I override?

You can override an inline style with the !important attribute

#element
{
    height: auto !important;
}

stuff here, nested <div> etc.<div> stuff here, nested <div> etc.被解释为html标签

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM