Problem:
The vertically neighbouring margins will be merged if they are not seperated by border or padding. The final margin pixels is the biggest one among them.
This is a feature of css that we sometimes need to take advantage of. But sometimes, we need to dismiss this function.
Solution:
In most cases, we need this default behavior of css. If we do need to dismiss it, we can use :after to do it.
http://www.apple.com/
uses this way to clear the margin.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<style>
.inner {
margin-top: 20px;
margin-bottom: 20px;
}
.clearfix-wrapper:after {
clear: both;
content: ".";
display: block;
height: 0;
visibility: hidden;
}
.visible-container{
border: 1px solid;
}
.container_with_padding{
padding:1px;
}
.selfclear:after {
clear: both;
content: ".";
display: block;
height: 0;
visibility: hidden;
}
</style>
</head>
<body>
<div>
<div class="inner">This is the top div with a bottom margin.</div>
</div>
<div class="clearfix-wrapper">
<div class="inner">Top margin overlap with the above div's margin. The bottom margin does not overlap because it is
cleared.
</div>
</div>
<div>
<div class="inner">The top margin is not overlapped with the previous one.</div>
</div>
<div class="visible-container">
<div class="inner">The visible border will clear the margin overlap.</div>
</div>
<div class="container_with_padding .selfclear">
<div class="inner">Padding will clear the margin overlap.</div>
</div>
<div>
<div class="inner">Cleared</div>
</div>
</body>
</html>
Try it on jsfiddle
Note:
There is no horizontally overlapped margin like the example here
.
分享到:
相关推荐
基于OVERLAPPED 的串口通信模块,目前已经在 商业使用中,有问题欢迎留言 模块已更新,请勿使用这个
Event和Overlapped小例子,很简单,最后一个时侯捷的win32多线程设计的APC例子修改版,以前的不能执行
overlapped model ,client and server
更新了下。。。 ************************************************************************ 函数名称:SP_InitComm 函数功能:初始化异步窗口操作模块 参数.... In/Out:In ...返回值类型:要读取的串口号码 ...
otherwise, pop-up windows are the same as overlapped windows of the WS_OVERLAPPE
基于重叠IO模型的服务器程序,可以同时支持上万的链接,性能直逼完成端口。
基于重叠IO模型的服务器程序,可以同时支持上万的链接,性能直逼完成端口。
3、 参考OverlappedEventServerDemo1理解Overlapped I/O事件通知的原理及过程。注意这个Demo只实现了使用重叠接收信息。 4、 参考OverlappedCompletionServerDemo2理解Overlapped I/O完成例程的原理及过程。注意这个...
C8051F320/1 Full Speed USB, 16k ISP FLASH MCU Family
compose the images with similar overlapped regions seamlessly. Traditional minimal error boundary (MEB) based method can’t produce correct stitching result when the input images exist photometric ...
在windows系统内平台下的网络IO模型,重叠IO的实现
winsock overlapped操作示例, tcp协议, 调用例程. c工程为接收服务器, d工程为发送工程. 环境vc6.
线性模型 线性整数规划Partially Overlapped Channel Assignment for Multi-Channel Wireless Mesh Networks.pdf
Illusion induced overlapped optics
重叠IO模型之OverLapped完成例程模型WSACompletionRoutineServer VS2010 基础入门 客户端与服务器端 客户端向服务器端发送数据 可接收多个客户端 #include #include #pragma comment (lib, "ws2_32.lib") #...
介绍当前Windows支持的各种Socket I/O模型 select WSAAsyncSelect WSAEventSelect Overlapped I/O(重叠IO模型),IOCP模型,有代码详细分析过程
' to perform the overlapped I/O operations necessary for serial communications. ' ' The routine can handle up to 4 serial ports which are identified with a ' Port ID. ' ' All routines (with the ...
基于重叠基因表达式变成的进化算法,彭京,唐常杰,受生物基因片段重叠表达现象的启发,本文提出了一种全新的基于重叠表达进化算法-MEOE。不同于已有的工作,MEOE提出了一个新的基因表
powerbuilder 9.0程序设计一周通1 powerbuilder 9.0程序设计一周通2 powerbuilder 9.0程序设计一周通3 powerbuilder 9.0程序设计一周通4 powerbuilder 9.0程序设计一周通5 powerbuilder 9.0程序设计一周通5