我正在尝试使用HTML和PHP设计收据。我设法创建了正确的布局,但是我需要将div旋转到90度。但它似乎溢出到顶部。 我必须将 margin-top:485px 设置为下面的右侧表的代码,以适合顶部。
<div class="rotate">
由于内容将来可能会变长或变短,所以我不想固定边距。
我的密码
.pagebreak {
page-break-after: always;
max-width: 8cm;
word-wrap: break-word;
}
.rotate {
-webkit-transform: rotate(-90deg) translate3d( 0, 0, 0);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="pagebreak">
<div class="rotate">
<label class="font-weight-bold text-center">SOME TITLE</label>
<table class="table">
<thead class="thead">
<tr colspan="3" class="">
</tr>
</thead>
<tbody>
<tr>
<td class="text-nowrap">
<div>
<label class="font-weight-bold" style="font-size:24px;">Seat No :
D6 </label>
</div>
<div id="label0" class="font-weight-bold" style="display:inline-block;" title="2BDA5339-3DAC-48DD-C1C2-8AA7D327A666"><canvas width="75" height="75" style="display: none;"></canvas><img alt="Scan me!" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAYAAAA4TnrqAAAEcElEQVR4Xu2c626sMBCD2fd/6D1iVbohG+ezEyqtDum/CsjF4/F4Au1j27bnNvDzfLYfezwep9Hq++rrx83Hfcd19btaKo17PKfucyDYd7bAcpDatu0XLMWUehwVecUQtQ5ijstQGofWTziV61hgAVpdsCj3a2YpLVBaRVpXM4U0jTSM1uHud5/ng1nuwyTctEhKD5WGKlg0Xh1UFZSenPwZWPWkVI3cakjVjDSMNHeBVdDuK8CiNKC0UkxU6eNWMZIDV3Yu1axbgpVGzBXcWYaQj0urbOorm8xaYJ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5F2Q3uJbAp2m4wGogQFWKQK7ThqwIMcnVrpTRPWd/WRreEiw3rdzTARrPFWLyQaProfnLcad9FqXXfwkWbcrVELexdjUrifw+Jp02UDXstVPTvSEJrcs819FT0BZYDcaoNuYvwfoHyIOmDZblgGQAAAAASUVORK5CYII="
style="display: block;"></div>
<script type="text/javascript" defer="">
// new QRCode(document.getElementById("qrcode"), "f738feb9-2f14-971b-f7b9-265755dfe795");
var qrcode = new QRCode("label0", {
text: "2BDA5339-3DAC-48DD-C1C2-8AA7D327A666",
width: 75,
height: 75,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H
});
</script>
</td>
<td class="text-nowrap">
<div><label class="font-weight-bold">Counter ID : PN001</label></div>
<div><label class="font-weight-bold">Ticket ID : 7</label></div>
<div><label class="font-weight-bold">Title : The Accidental Astronauts</label></div>
<div><label class="font-weight-bold">Category : Adult</label></div>
<div><label class="font-weight-bold">Type : Film</label></div>
<div><label class="font-weight-bold">Location : ROOM1</label></div>
</td>
<td class="text-nowrap">
<div><label class="font-weight-bold">Date : 21-02-2019</label></div>
<div><label class="font-weight-bold">Showtime : 12:30 AM - 11:30 PM</label></div>
<div><label class="font-weight-bold">Price : RM 12.00</label></div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
</body>
</html>
当前输出:图片被切半
旋转div后的预期输出:
答案 0 :(得分:0)
.rot90 {
-webkit-transform: translateY(-100%) rotate(90deg); /* Safari */
-moz-transform: translateY(-100%) rotate(90deg); /* Firefox 3.6 Firefox 4 */
/*-moz-transform-origin: right top; */
-ms-transform: translateY(-100%) rotate(90deg); /* IE9 */
-o-transform: translateY(-100%) rotate(90deg); /* Opera */
transform: translateY(-100%) rotate(90deg); /* W3C */
-webkit-transform-origin: left bottom;
-moz-transform-origin: left bottom;
-ms-transform-origin: left bottom;
-o-transform-origin: left bottom;
transform-origin: left bottom;
}