表格 文本框 按钮个人笔记

7 篇文章 0 订阅
本文记录了使用CSS3和HTML5进行网页元素样式设计的一些个人心得,主要探讨如何优雅地定制表格、文本框和按钮的外观与交互效果,包括边框样式、填充颜色、响应式布局等关键点。
摘要由CSDN通过智能技术生成
table:表格  文本框 按钮
<table>
<caption>表格标题</caption>
<thead>                                  !表头
   <tr>                                      行
        <th>                                表头单元格
        </th>
   </tr>
</thead>
<tbody>                                  !表体
    <!-- tr*2>td*3{$$表格内容} -->
    <tr>
        <td>01表格内容</td>  单元格
        <td colspan="2">02表格内容</td>      !合并2列
         <td>03表格内容</td>
    </tr>
    <tr>                                  
        <td  rowspan="2">01表格内容</td>      !合并下面两行
        <td>02表格内容</td>
        <td>03表格内容</td>
    </tr>
</tbody>
<tfoot>                                   !表尾
</tfoot>
<table>

table{border-spainf:0;               !是消去表格空格
border-collapse:collapse           !合并单元格边框线
}

栅格:<div class=“col-xs-12(最小的时候一个占12份占满) col-md-2(中等的时候一个占两份) col-lg -1(最大的时候一个占一份”>123</div>          !宽度总占12份
.visible-xs-*(block)仅手机可见                                           .hidden-xs (仅手机隐藏)


<select></select>            !下拉菜单
<option></option>            !下拉菜单选项
<textarea cols=“30” rows=“30”></textarea>  !  输入框

<input type=“text(password checkbox checkbox radio button submit email file color number date)” placeholder=“提示信息”  value=“框内的值” name=“自定义名”/> 
!文本框(加密文字 复选框 单选框 按钮 提交按钮 邮箱 输入文件路径 取色器 只能数字 日期)        点击提交松开后刷新表单
maxlength=“1”     字符限制数量

<button>登录</button>    登录按钮
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1.1 编computer.html页面 ```html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>新增笔记本</title> </head> <body> <h1>新增笔记本</h1> <form action="AddComputerServlet" method="post"> <p> <label>品牌:</label> <input type="text" name="brand"> </p> <p> <label>颜色:</label> <input type="radio" name="color" value="红色">红色 <input type="radio" name="color" value="白色">白色 <input type="radio" name="color" value="黑色">黑色 </p> <p> <label>价格:</label> <input type="text" name="price"> </p> <input type="submit" value="提交"> </form> <br> <a href="ShowComputerServlet">查看笔记本信息</a> </body> </html> ``` 1.2 编Computer实体类 ```java public class Computer { private String brand; private String color; private double price; public Computer() { } public Computer(String brand, String color, double price) { this.brand = brand; this.color = color; this.price = price; } public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } } ``` 1.3 编AddComputerServlet类 ```java public class AddComputerServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 获取表单数据 String brand = request.getParameter("brand"); String color = request.getParameter("color"); double price = Double.parseDouble(request.getParameter("price")); // 创建Computer对象 Computer computer = new Computer(brand, color, price); // 将Computer对象存入Set集合 Set<Computer> computers = (Set<Computer>) getServletContext().getAttribute("computers"); computers.add(computer); // 将Set集合存入合适的作用域 getServletContext().setAttribute("computers", computers); // 跳转到ShowComputerServlet response.sendRedirect("ShowComputerServlet"); } } ``` 1.4 编ShowComputerServlet类 ```java public class ShowComputerServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 获取所有Computer对象的Set集合 Set<Computer> computers = (Set<Computer>) getServletContext().getAttribute("computers"); // 创建2个表格,第1个表格展示自己新增的笔记本信息,第2个表格展示所有人新增的笔记本信息 PrintWriter out = response.getWriter(); out.println("<html><head><title>笔记本信息列表</title></head><body>"); out.println("<h1>笔记本信息列表</h1>"); out.println("<h2>自己新增的笔记本信息</h2>"); out.println("<table border='1'><tr><th>品牌</th><th>颜色</th><th>价格</th></tr>"); for (Computer computer : computers) { if (computer.equals(request.getSession().getAttribute("computer"))) { out.println("<tr><td>" + computer.getBrand() + "</td><td>" + computer.getColor() + "</td><td>" + computer.getPrice() + "</td></tr>"); } } out.println("</table>"); out.println("<h2>所有人新增的笔记本信息</h2>"); out.println("<table border='1'><tr><th>品牌</th><th>颜色</th><th>价格</th></tr>"); for (Computer computer : computers) { out.println("<tr><td>" + computer.getBrand() + "</td><td>" + computer.getColor() + "</td><td>" + computer.getPrice() + "</td></tr>"); } out.println("</table>"); out.println("</body></html>"); } } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值