gpt4 book ai didi

javascript - 使用 CSS 和 Bootstrap 打印网页 - 第二页边距关闭

转载 作者:行者123 更新时间:2023-11-28 07:00:16 25 4
gpt4 key购买 nike

我正在使用下面发布的 html
当我打印(或打印预览)时,第 1 页上的人物 div 框正确对齐,但在所有后续页面上,第一人称 div 框偏向左侧。

The person box is on page 2

看起来如果我删除 page-break-inside: avoid from the css 这会消失,但是分页符上的框会被破坏,我想避免这种情况。

我做错了什么?

.person-box {
border: 1px solid #000000;
padding: 10px;
margin-bottom: 10px;
margin-left: 10px;
cursor: pointer;
page-break-inside: avoid;
}
.FieldName {
font-weight: bold;
padding: 5px;
/*border-bottom: 1px solid black;*/
}
.application-mugshot img {
height: 105px;
width: 105px;
}
span.application-name {
display: block;
font-weight: bold;
font-size: larger;
}
span.application-address,
span.application-phone,
span.application-email {
display: block;
}
<!DOCTYPE html>
<html>

<head>
<title></title>
<!-- META TAGS -->
<meta charset="utf-8" />
<meta name="viewport" content="user-scalable=0,width=device-width,height=device-height,initial-scale=1,maximum-scale=1" />
<!-- CSS FILES -->
<link href="Styles/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="Styles/font-awesome.min.css" rel="stylesheet" type="text/css">

<style>
</style>
</head>

<body>

<!-- HEADER -->
<header id="header-container">

</header>

<!-- MAIN CONTAINER -->
<section class="maincontainer">
<form name="frmMain" id="frmMain">

<div>

</div>
<div id="divMainWrapper" class="MainWrapper">
<div id="divMain" class="Main">
<div id="divContent" class="row">
<div class="row">

<div class="col-xs-1 "></div>
<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>


<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>
<div class="col-xs-1 "></div>

<div class="col-xs-5 person-box">
<input name="ctl394" type="text" value="YjYJD%2fbC9%2frhmCBxZqp8TA%3d%3d" class="application-id" style="display:none;" />
<div class="row">
<div class="col-xs-4 application-mugshot">
<img class="MugShot img-responsive animated rubberBand" src="..\Pictures\Applications\600\default.jpg" style="border-width:0px;left:-57;" />
</div>
<div class="col-xs-8">
<span class='application-name'>Smith, Joe</span><span class='application-address'>123 Main St&nbsp;</span><span class='application-address'>&nbsp;</span><span class='application-address'>New York, NY 13456&nbsp;</span><span class='application-phone'>(555) 555-1212&nbsp;</span>
<span
class='application-email'>joesmith@fakemail.com&nbsp;</span>
</div>
</div>
</div>

</div>
</div>
</div>
</div>
</form>
<!-- FOOTER -->

</section>
<!-- JS FILES -->
<script type="text/javascript" src="JavaScripts/jQuery/jquery.js"></script>
<script type="text/javascript" src="JavaScripts/Bootstrap/bootstrap.js"></script>

<script type="text/javascript" src="JavaScripts/Common.js"></script>
<script type="text/javascript" src="JavaScripts/Forms/Application_Summary.js"></script>



</body>

</html>

这是一个 zip 文件,可以下载并在打印预览中在本地运行以重现该问题: https://www.dropbox.com/s/t9n0cy06rdo1zt8/PrintProblem.zip?dl=0

最佳答案

如您在文档 (http://getbootstrap.com/css/#grid) 中所见, Bootstrap 网格模型无法按照您实现它的方式工作

它总是这样的结构:

<div class="row">
<div class="col-xs-6"></div>
<div class="col-xs-6"></div>
</div>
<div class="row">
<div class="col-xs-2"></div>
<div class="col-xs-8"></div>
<div class="col-xs-2"></div>
</div>
//and so on

您始终需要使每一行的列都达到“12”。在我的示例中,它是 1) 6+6 = 12 和 2) 2+8+2=12。你列类需要填写12。希望它有帮助

关于javascript - 使用 CSS 和 Bootstrap 打印网页 - 第二页边距关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33280860/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com