Code PHP && Ứng Dụng
Thứ Tư, 8 tháng 7, 2026
Hiệu ứng Popup - Detail Product
Thứ Hai, 6 tháng 7, 2026
Hover Button css đẹp
## HTML
<div class="box-send-contact">
<button class="button dark">Gửi thông tin</button>
</div>
## CSS
.button.dark {
color: #fff;
border-color: #0d2445;
}
.box-send-contact button {
display: block;
margin: 2rem auto 3rem auto;
}
.button:before {
position: absolute;
content: '';
display: block;
left: -2px;
top: 0;
right: -2px;
bottom: 0;
transform: scale(1, 1);
transform-origin: left center;
z-index: -1;
background-color: #ffffff;
transition: transform 0.45s cubic-bezier(0.785, 0.135, 0.15, 0.86);
}
.button.dark:before {
background-color: #0d2445;
}
.button {
font-weight: 600;
position: relative;
display: inline-block;
padding: 1rem 2.8rem;
line-height: normal;
border: 1px solid #ffffff;
border-radius: 50px;
text-transform: uppercase;
font-size: 1.2rem;
text-align: center;
letter-spacing: 1px;
background-color: transparent;
transition: color 0.45s cubic-bezier(0.785, 0.135, 0.15, 0.86), border 0.45s cubic-bezier(0.785, 0.135, 0.15, 0.86);
z-index: 1;
color: #0d2445;
overflow: hidden;
}
.button:hover:before {
transform-origin: right center;
transform: scale(0, 1);
}
button:focus:not(:focus-visible) {
outline: 0;
}
button.dark:hover {
color: #0d2445;
}
Thứ Tư, 1 tháng 7, 2026
CSS clamp
height: clamp(280px, 23vw, 450px);
có nghĩa là chiều cao sẽ tự co giãn theo kích thước màn hình nhưng luôn nằm trong khoảng từ 280px đến 450px.
Cú pháp của clamp() là:
clamp(MIN, PREFERRED, MAX)
- 280px → Giá trị nhỏ nhất (không bao giờ thấp hơn).
- 23vw → Giá trị mong muốn (23% chiều rộng của cửa sổ trình duyệt).
- 450px → Giá trị lớn nhất (không bao giờ vượt quá).
Ví dụ
| Chiều rộng màn hình | 23vw | Kết quả |
|---|---|---|
| 320px | 73.6px | 280px (vì nhỏ hơn min) |
| 768px | 176.6px | 280px |
| 1200px | 276px | 280px |
| 1400px | 322px | 322px |
| 1600px | 368px | 368px |
| 2200px | 506px | 450px (vì vượt max) |
Khi nào dùng?
Ví dụ cho ảnh sản phẩm:
.dmsp-image {
height: clamp(280px, 23vw, 450px);
}
- Điện thoại → cao 280px.
- Tablet → khoảng 280–320px.
- Desktop → khoảng 320–450px.
- Màn hình siêu rộng → tối đa 450px, không bị quá cao.
Một số giá trị thường dùng
/* Luôn từ 250px đến 400px */
height: clamp(250px, 20vw, 400px);
/* Phù hợp card sản phẩm */
height: clamp(280px, 25vw, 420px);
/* Banner */
height: clamp(300px, 35vw, 700px);
clamp() rất hữu ích vì bạn không cần viết nhiều @media để thay đổi chiều cao theo từng kích thước màn hình.
Thứ Hai, 15 tháng 6, 2026
Click More - Less HTML+JS+CSS
Thứ Tư, 10 tháng 6, 2026
Icon trong select css đẹp
**** HTML
<div class="select-wrap">
<select name="customer_shipping_phuongxa" id="customer_shipping_phuongxa">
<option value="">Chọn Phường / Xã</option>
</select>
</div>
**** CSS
.appline .select-wrap{
position:relative;
width:100%;
}
.appline .select-wrap select{
-webkit-appearance:none;
-moz-appearance:none;
appearance:none;
background:#fff;
border:1px solid #d9d9d9;
box-sizing:border-box;
border-radius:16px !important;
height:40px !important;
width:100%;
padding:5px 45px 5px 20px !important;
transition:all .2s;
font-size:14px;
cursor:pointer;
}
.appline .select-wrap select::-ms-expand{
display:none;
}
.appline .select-wrap:after{
content:"";
position:absolute;
top:50%;
right:18px;
margin-top:-2px;
width:0;
height:0;
border-style:solid;
border-width:5px 4px 0 4px;
border-color:#888 transparent transparent transparent;
pointer-events:none;
}
Thứ Tư, 27 tháng 5, 2026
htmlspecialchars show hết lỗi dấu nháy - bird" s
$title_en="bird's nest products";
<input class="form-control" id="txt_name_en" name="txt_name_en" placeholder="Tên sản phẩm - Tiếng anh (*)" value="bird" s="" nest="" products'="" maxlength="80" required="">
và sử dụng hàm htmlspecialchars là OK.
htmlspecialchars($title_en, ENT_QUOTES)





