当前位置:首页 > CSS

html css 制作单据

2026-01-15 11:53:34CSS

HTML 和 CSS 制作单据的方法

单据通常需要清晰的布局和结构化的数据展示。以下是制作单据的步骤:

HTML 结构

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>单据</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <div class="invoice">
        <header class="invoice-header">
            <h1>销售单据</h1>
            <div class="invoice-info">
                <span>单据编号: INV-2023-001</span>
                <span>日期: 2023-10-15</span>
            </div>
        </header>

        <div class="invoice-body">
            <div class="client-info">
                <h2>客户信息</h2>
                <p>姓名: 张三</p>
                <p>地址: 北京市朝阳区</p>
                <p>电话: 13800138000</p>
            </div>

            <table class="invoice-items">
                <thead>
                    <tr>
                        <th>项目</th>
                        <th>数量</th>
                        <th>单价</th>
                        <th>金额</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>商品A</td>
                        <td>2</td>
                        <td>100.00</td>
                        <td>200.00</td>
                    </tr>
                    <tr>
                        <td>商品B</td>
                        <td>1</td>
                        <td>150.00</td>
                        <td>150.00</td>
                    </tr>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="3">总计</td>
                        <td>350.00</td>
                    </tr>
                </tfoot>
            </table>
        </div>

        <footer class="invoice-footer">
            <p>感谢您的惠顾!</p>
            <p>公司名称: ABC有限公司</p>
        </footer>
    </div>
</body>
</html>

CSS 样式

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
}

.invoice {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.invoice-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.invoice-info {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.client-info {
    margin-bottom: 20px;
}

.invoice-items {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.invoice-items th, .invoice-items td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.invoice-items th {
    background-color: #f2f2f2;
}

.invoice-items tfoot {
    font-weight: bold;
}

.invoice-footer {
    text-align: center;
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

关键要点

单据设计应注重清晰度和专业性。HTML 结构使用语义化标签,CSS 样式确保布局整齐。表格用于展示项目明细,页眉和页脚包含必要信息。

响应式设计确保单据在不同设备上可读。适当使用边框和背景色增强视觉效果,同时避免过度装饰影响实用性。

打印样式可添加 @media print 查询优化打印效果。单据编号和日期等关键信息应突出显示,便于后续查询和归档。

html css 制作单据

标签: 单据html
分享给朋友:

相关文章

vue实现单据

vue实现单据

Vue 实现单据功能 在 Vue 中实现单据功能通常涉及表单设计、数据绑定、验证和提交等步骤。以下是关键实现方法: 表单设计与数据绑定 使用 Vue 的 v-model 实现表单数据双向绑定。例如…

jquery 插入html

jquery 插入html

jQuery 插入 HTML 的方法 jQuery 提供了多种方法来动态插入 HTML 内容到 DOM 中。以下是几种常用的方法: append() 将内容插入到选定元素的内部末尾。 $("#…

vue实现html跳页

vue实现html跳页

Vue 实现 HTML 跳页的方法 在 Vue 中实现页面跳转(路由导航)可以通过多种方式完成,以下是常见的几种方法: 使用 Vue Router 的 router-link 组件 Vue Rou…

elementui单据

elementui单据

以下是关于Element UI中实现单据(如订单、表单等)功能的整理方案,结合组件库特性和常见业务场景: 表单数据绑定 使用 el-form 组件绑定单据数据模型,支持动态表单字段和校验规则。示例代…

react 如何显示html

react 如何显示html

渲染原始 HTML 在 React 中直接插入原始 HTML 需要使用 dangerouslySetInnerHTML 属性。这个属性允许将 HTML 字符串直接渲染到 DOM 中,但需要注意潜在的安…