Khung với HTML - cách thức hoạt động
Để làm cho phương tiện truyền thông trên trang web của bạn hấp dẫn hơn, bạn có thể sử dụng mã HTML để vẽ một khung xung quanh nó. Trong mẹo thực tế này, chúng tôi cho bạn thấy cách thức này hoạt động và những lợi thế của bảng kiểu xếp tầng (CSS) mang lại khi xác định khung.
Mã hóa HTML - vẽ các khung xung quanh hình ảnh và các phương tiện khác
Theo mặc định, mỗi hình ảnh có một khung rộng một pixel. Tuy nhiên, điều này chỉ hiển thị nếu hình ảnh được sử dụng như một siêu liên kết. Với thuộc tính "viền", bạn có thể xác định riêng độ dày của khung.
- Trong HTML, mã cho khung đen mười pixel trông giống như thế này:
- Khung này được áp dụng cho tất cả bốn phía của đối tượng.
- Ngoài ra, bạn có thể sử dụng chương trình chỉnh sửa hình ảnh như Gimp để vẽ khung xung quanh hình ảnh của bạn.
- Tuy nhiên, xin lưu ý rằng điều này sẽ làm cho hình ảnh lớn hơn và sẽ mất nhiều thời gian hơn để khách truy cập vào trang web của bạn để tải xuống hình ảnh.
Xác định khung trong tài liệu HTML bằng CSS
Bạn có thể xác định khung - ví dụ như một hộp xung quanh văn bản - với các biểu định kiểu xếp tầng chính xác hơn nữa.
- Một mẹo thực tế khác cho bạn biết cách tích hợp tệp CSS vào trang web của bạn.
- Trong tài liệu CSS này, bạn có thể đặt màu và độ dày của khung khác nhau cho cả bốn trang:
- viền dưới: # 999 - Đặt màu cho khung dưới cùng. Tại đây, bạn cũng có thể sử dụng "viền trên cùng", "viền phải" hoặc "viền trái".
- Border-width: 0 0 thin thin - Chỉ định độ dày đường kẻ. Điều này được thực hiện theo chiều kim đồng hồ. Ở đây điều này có nghĩa là không có dòng nào có thể nhìn thấy ở trên cùng và bên phải, trong khi một dòng mỏng đã được xác định ở dưới cùng và bên trái.
- kiểu viền: không có rãnh rãnh nào - Xác định khung trang trí cho hình ảnh hoặc hộp của bạn. Kiểu "rãnh" tạo hiệu ứng 3D.
Trang chủ của bạn tự nhiên sống từ sự hiện diện của nó trên mạng. Trong bài viết tiếp theo, bạn sẽ đọc các mẹo tốt nhất để cải thiện thứ hạng Google của bạn.