gpt4 book ai didi

css - Bootstrap 页面打印

转载 作者:太空宇宙 更新时间:2023-11-04 09:30:04 25 4
gpt4 key购买 nike

我想打印 Bootstrap 页面。这是我的页面布局

<div class="container">
<div class="row">
<div class="col-sm-4">
<img src="image/logo.png">
</div>
</div>
</div>
<div class="container" id="student">
<div class="row">
<div class="col-sm-4">
<h1>Student</h1>
</div>
<div class="col-sm-offset-2 col-sm-6" id="date">
<form class="form-inline">
<div class="form-group">
<label for="focusedInput"> <b>Date:</b></label>
<input class="form-control" id="focusedInput" type="text" placeholder="DD Month Year">
</div>
</form>
</div>
</div>
</div>

我也有CSS

@font-face {
font-family: "myfont";
src: url("../fonts/opensans/OpenSans-Regular 2.ttf");
}
body{
font-family: "myfont";
/*-webkit-print-color-adjust: exact;*/
}

img{
width: 150px;
}
#student{
margin-top: 50px;
}
#date{
background: black;
margin-top: 20px;
color: white;
padding: 10px;
}

问题是:css 没有正确加载。我尝试搜索 stackoverflow 但没有得到任何确切的解决方案。我怎样才能做到这一点?这是 fiddle https://jsfiddle.net/wc6rga7o/

最佳答案

尝试

@media print {
/* Your styles here */
body{
color: #111111;
}
#date{
-webkit-print-color-adjust: exact!important;
}

}

更新了你的 fiddle https://jsfiddle.net/wc6rga7o/2/

enter image description here

关于css - Bootstrap 页面打印,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40842057/

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