﻿@media print {
    @page {
        size: 50mm 70mm; /* 指定紙張大小 */
        margin: 0; /* 移除所有邊距 */
    }

    /* 確保打印顏色調整正確 */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important; /* 支援非-Webkit 瀏覽器 */
    }

    /* 隱藏不需要打印的元素 */
    .noPrint {
        display: none !important;
    }



    /* 打印區域的樣式 */
    #printArea {
        color: green;
        line-height: 0.8;
        margin: 0; /* 避免內容溢出 */
        padding: 2mm; /* 在內容周圍添加內邊距 */
        box-sizing: border-box; /* 確保 padding 不影響最終尺寸 */
        width: 50mm; /* 確保內容區域的寬度 */
        height: 60mm; /* 確保內容區域的高度 */
        overflow: hidden; /* 防止內容溢出 */
    }
 

    /* 標題樣式 */
    .print-title {
        font-size: 10pt; /* 縮小字體大小 */
        text-align: center; /* 中央對齊 */
        margin: 0; /* 移除外邊距 */
        margin-bottom: 5mm; /* 增加標題底部的間距 */
    }

    #printArea div {
        border: 1px solid green;
        padding: 1mm; /* 調整內邊距，確保不超出邊界 */
        border-radius: 5px;
        box-sizing: border-box; /* 確保邊框和內邊距不影響尺寸 */
    }

    #printArea p strong {
        font-weight: bold;
    }

    /* 確保文本不溢出 */
    #printArea p {
        overflow-wrap: break-word; /* 允許單詞換行 */
        word-wrap: break-word; /* 舊版瀏覽器支持 */
        white-space: normal; /* 允許正常換行 */
        font-size: 8pt; /* 設置適合的字體大小 */
    }
 
}
