Tìm theo từ khóa

Table responsive cho các thiết bị mobile table, thay thế table cho flatsome



Quá trình mình thiết kế website và sử dụng chưa bao giờ thấy cái table nào xí còn không hỗ trợ mobile như cái table của Flatsome. Chắc là nhà phát hành theme muốn tạo công ăn việc làm cho anh em dev. Sau đây là Css cho bảng thay thế cho table mặc định rất xí và không responsive của theme Flatsome 🙂

CSS

/** codfe.com - table css **/

table {
	width: 100%!important;
	border-collapse: collapse;
}
tr:first-child {
	background: #049cdb!important;
	color:white
}
 
tr:nth-of-type(odd) {
	background: #eee;
}

td {
	padding: 6px;
	border: 1px solid #ccc;
	text-align: left;
	padding-left:10px;
	padding-left:15px !important;
}
th {
	padding: 6px;
	border: 1px solid #ccc;
	text-align: left;
	padding-left:15px !important;
	background: #1E73BE;
}

Shortcode Table responsive cho mobile và các thiết (cho vào function.php)

/** Codfe responsive cho table [codfe-table]noi dung[/codfe-table]**/
add_shortcode('codfe-table','codfe_table');
function codfe_table($args, $content){
	return '<div class="table-responsive">'.$content.'<div>';
	
}

khi dùng thì thêm shortcode như sau

[codfe-table]noi dung[/codfe-table]
table responsive css for wordpress
table responsive css for wordpress

Nếu chỉ muốn chỉnh CSS cho table riêng bài viết (post) hay trong trang sản phẩm thì thêm class .blog-single hoặc.woocommerce-tabs như bên dưới

Cho single post trong wordpress

/**
codfe.com - table css cho post
**/
.blog-single table {
width: 100%;
border-collapse: collapse;
} ....

Cho trang sản phẩm – product woocommerce

/**
codfe.com - table css cho product
**/

.woocommerce-tabs table {
width: 100%;
border-collapse: collapse;
}
....

Chúc các bạn thành công!

5/5 - (1 bình chọn)
0 0 đánh giá
Đánh giá bài viết
Theo dõi
Thông báo của
guest
0 Góp ý
Mới nhất
Cũ nhất Được bỏ phiếu nhiều nhất
0
Rất thích suy nghĩ của bạn, hãy bình luận.x