gpt4 book ai didi

html - 浏览器打印设计

转载 作者:太空宇宙 更新时间:2023-11-04 05:49:56 27 4
gpt4 key购买 nike

我想让页眉位置固定。所以我为 .Header { position:fixed; 编写了 CSS。顶部:0;左:0;宽度:100%; } 在第一页没有问题。如果页面不止一个,则按表重叠标题。我试过给表格 margin-top 但没有用。

我想让标题像下面的图片一样固定: I want to make header fixed like image down below

我的代码:

        <style>
@page {
size: 8.27in 5.8in Portrait;
}

body {
font-family: Consolas, Courier, sans-serif;
font-size: 14px;
margin: 0;
}

label {
font-weight: 600;
line-height: 30px;
}

ul {
list-style: none;
padding: 0;
}

table {
margin: 8px 0;
width: 100%;
}

.printTable table thead {
background: #ddd;
}

.printTable table,
.printTable th,
.printTable td {
border: 1px solid #a9a6a6;
border-collapse: collapse;
padding: 5px 8px;
text-align: left;
}

.printTable table tr th:first-child {
width: 7%;
}

.hide {
display: none;
}

.Header h4,
.Header h2 {
margin-bottom: 4px;
margin-top: 4px;
}

img {
width: 130px;
height: 140px;
}

.PrintFoot p {
margin: 0 0 3px 0;
}

.Header {
position: fixed;
top: 0;
left: 0;
width: 100%;
}


/* .printTable {
margin-top: 300px !important;
}*/

</style>




<div class="main-div">
<div class="Header">
<div style="overflow: auto;">
<div style="width: 20%; float: left;">
<img src="https://www.opticcell.com/wp-content/uploads/logo-patriot-250x250.png">
</div>

<div style="width: 70%; float: left; text-align: center; font-family:'Lato', sans-serif;">
<div style="padding-left: 20px;">
<h2> {Company} </h2>
<h2 style="font-size: 16px;"> {MailName} </h2>
<h4> {Address}</h4>
<h4> {Phone}</h4>
<strong>PAN :</strong> {pan}
<h4>{InvoiceCopy}</h4>
</div>
</div>
<div style="width: 20%;"></div>
</div>

<div style="overflow: auto;">
<div style="width: 50%; float: left; text-align:left;">
<strong>Invoice No :</strong> {Invoice}
<br>
<strong>Patient ID :</strong> {PatientID}
<br>
<strong>Patient Name :</strong> {PatientName}
<br>
<strong>Age/Sex: </strong> {PatientAge}
<br>
<strong>Address :</strong> {PatientAddress}
<br>
<strong>Contact :</strong> {contact}
<br>
<strong>Party PAN :</strong> {party}
<br>
<strong>IP no. : </strong> {ipno}
</div>

<div style="width: 50%; float: left; text-align: right;">
<strong>Date :</strong> {Date}
<br>
<strong>Claim Code :</strong> {ClaimID}
<br>
<strong>Billing Type :</strong> {Type}
<br>
<strong>Bill To :</strong> {AccountLedger}
<br>
<strong>Payment mode :</strong> {Type}
<br>
<strong>Refer By:</strong> {refer}
<br>
<strong>Location:</strong> {location}
</div>
</div>
</div>

<div class="MiddlePart">
<div class="printTable">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>S.N.</th>
<th>Particular</th>
<th>Qty</th>
<th>Rate</th>
<th>Net Total</th>
</tr>
</thead>

<tbody>
<tr>
<td>S.N.</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>1</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>2</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>3</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>4</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>5</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>6</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>7</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>8</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>9</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>10</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>11</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>12</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>13</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>14</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>15</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>16</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>17</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>18</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>19</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>20</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>21</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>22</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>23</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>24</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>25</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>

<tr>
<td>26</td>
<td>Particular</td>
<td>Qty</td>
<td>Rate</td>
<td>Net Total</td>
</tr>
</tbody>
</table>
</div>

<div style="overflow: auto;">
<div style="width: 68%; float: left;">
<strong>Pre-Deposit :</strong> {preDepo}
<br>
<strong>New Deposit :</strong> {newDepo}
<br>
<strong>New Deposit :</strong> {newDepo}
<br>
<strong>In Words: </strong> {InWords}
</div>

<div style="width: 32%; float: left; text-align: right;">
<strong>Bill Total: </strong> {BillTotal}
<br>
<strong>Discount : </strong> {Discount}
<br>
<strong>Net Total : </strong> {NetTotal}
<br>
<strong>Net Total : </strong> {NetTotal}
<br>
<strong>Net Total : </strong> {narration}
<br>
<strong>Enter By :</strong> {User}
</div>
</div>
</div>

<div class="PrintFoot" style="margin-top: 10px;">
<p><strong>Lab Login :</strong> {LoginCredential}</p>
<p><strong>Print Date : </strong> Admin {PrintDate}</p>
<p style="margin: 15px 0;">
<strong>Note : </strong>
If there are any, kindly bring all previous reports and documents on the day of the appointment or treatment. There will be no refunds without original invoice. </p>

<p style="text-align: center;">Get Well Soon !!</p>
</div>
</div>

<!-- end snippet -->

最佳答案

在您的 CSS 代码中,您应该从 Header claas 中删除属性 position: fixed;

.Header {
position: fixed; **Remove this property from it and check it's working fine for you**
top: 0;
left: 0;
width: 100%;
}

关于html - 浏览器打印设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58370441/

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