2013-10-08 60 views

回答

6

定位內容當前放置根據主要內容容器,或者body元素。爲確保沒有重疊,請在頁面上添加頁邊空白,然後負面放置內容以將其移到內部(#header { position: fixed; top: -50px; left: 0px; right: 0px; height: 50px; })。

例如:

<html> 
<head> 
    <style> 
    @page { margin: 50px; } 
    body { background-color: #c0ccff; padding: 1em; } 
    #header { position: fixed; top: -50px; left: 0px; right: 0px; height: 50px; background-color: orange; padding: .5em; text-align: center; } 
    </style> 
</head> 
<body> 
    <div id="header">HEAD</div> 
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut tempor gravida enim, id sollicitudin eros ullamcorper a. Cras vitae convallis dolor. Maecenas eget fermentum magna. Donec gravida neque vel sapien congue consequat. Nulla facilisi. Sed volutpat dui et nibh posuere, eu malesuada arcu congue. Cras vehicula elit eros, non tristique leo congue quis. Morbi aliquam scelerisque augue, eu sodales dolor. Integer a commodo nibh. </p> 
    <div style="page-break-before: always;"></div> 
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut tempor gravida enim, id sollicitudin eros ullamcorper a. Cras vitae convallis dolor. Maecenas eget fermentum magna. Donec gravida neque vel sapien congue consequat. Nulla facilisi. Sed volutpat dui et nibh posuere, eu malesuada arcu congue. Cras vehicula elit eros, non tristique leo congue quis. Morbi aliquam scelerisque augue, eu sodales dolor. Integer a commodo nibh. </p> 
</body> 
</html> 
+0

耶!它的工作感謝你的時間。 –