使用 Flask-Table 如何更改表格设计?
Using Flask-Table how do I change the tables design?
我正在使用 Flask-Table
,但我不知道如何更改 table 的 html
设计。有人知道我是怎么做到的吗?
为了添加 CSS 设计,您需要一个 CSS class 这样的:
table.blueTable {
border: 1px solid #4169E1;
background-color: #008CBA;
width: 100%;
text-align: left;
border-collapse: collapse;
}
table.blueTable td, table.blueTable th {
border: 1px solid #AAAAAA;
padding: 3px 2px;;
}
table.blueTable tbody td {
font-size: 13px;
}
table.blueTable tr:nth-child(even) {
background: #15AAE1;
}
table.blueTable thead {
background: #1C6EA4;
background: -moz-linear-gradient(top, #5592bb 0%, #327cad 66%, #1C6EA4 100%);
background: -webkit-linear-gradient(top, #5592bb 0%, #327cad 66%, #1C6EA4 100%);
background: linear-gradient(to bottom, #5592bb 0%, #327cad 66%, #1C6EA4 100%);
border-bottom: 2px solid #444444;
}
table.blueTable thead th {
font-size: 15px;
font-weight: bold;
color: #E1E1E1;
border-left: 2px solid #D0E4F5;
}
table.blueTable thead th:first-child {
border-left: none;
}
table.blueTable tfoot td {
font-size: 14px;
}
table.blueTable tfoot .links {
text-align: right;
}
table.blueTable tfoot .links a{
display: inline-block;
background: #1C6EA4;
color: #FFFFFF;
padding: 2px 8px;
border-radius: 5px;
}
并且您需要将 class 应用于 table,如以下代码所示:
room_table = User_Room_Table(items=RoomHelper.get_by_user(user_name=current_user.username), border=11,
classes=['blueTable']
我正在使用 Flask-Table
,但我不知道如何更改 table 的 html
设计。有人知道我是怎么做到的吗?
为了添加 CSS 设计,您需要一个 CSS class 这样的:
table.blueTable {
border: 1px solid #4169E1;
background-color: #008CBA;
width: 100%;
text-align: left;
border-collapse: collapse;
}
table.blueTable td, table.blueTable th {
border: 1px solid #AAAAAA;
padding: 3px 2px;;
}
table.blueTable tbody td {
font-size: 13px;
}
table.blueTable tr:nth-child(even) {
background: #15AAE1;
}
table.blueTable thead {
background: #1C6EA4;
background: -moz-linear-gradient(top, #5592bb 0%, #327cad 66%, #1C6EA4 100%);
background: -webkit-linear-gradient(top, #5592bb 0%, #327cad 66%, #1C6EA4 100%);
background: linear-gradient(to bottom, #5592bb 0%, #327cad 66%, #1C6EA4 100%);
border-bottom: 2px solid #444444;
}
table.blueTable thead th {
font-size: 15px;
font-weight: bold;
color: #E1E1E1;
border-left: 2px solid #D0E4F5;
}
table.blueTable thead th:first-child {
border-left: none;
}
table.blueTable tfoot td {
font-size: 14px;
}
table.blueTable tfoot .links {
text-align: right;
}
table.blueTable tfoot .links a{
display: inline-block;
background: #1C6EA4;
color: #FFFFFF;
padding: 2px 8px;
border-radius: 5px;
}
并且您需要将 class 应用于 table,如以下代码所示:
room_table = User_Room_Table(items=RoomHelper.get_by_user(user_name=current_user.username), border=11,
classes=['blueTable']