Môn HTML, CSS
Môn HTML, CSS
Phím tắt.......................................................................................................................................................1
Thêm icon....................................................................................................................................................1
Click vào nd1 mới hiển thị thêm nd2...........................................................................................................2
Ảnh có ghi chú.............................................................................................................................................2
Model/popup/shadow................................................................................................................................2
display: flex..................................................................................................................................................3
wrap text around img..................................................................................................................................4
inline:...........................................................................................................................................................4
Đặt tên file:..................................................................................................................................................4
Đặt tên class:...............................................................................................................................................4
css selector:.................................................................................................................................................4
Semantic HTML:..........................................................................................................................................5
role attribute providing meaning to the asssistive techonologies;..............................................................5
form:............................................................................................................................................................6
display: grid.................................................................................................................................................6
string literal.................................................................................................................................................6
destructuring...............................................................................................................................................6
Phím tắt
Gõ dấu ! -> hiện ra gợi ý và chọn
Thêm icon
.btn{
&:hover{
cursor: pointer;
opacity: 0.9;
}
<summary>nd1</summary>
<p>nd2</p>
</details>
<img/>
<figcaption>
</figcaption>
</figure>
Model/popup/shadow
VD1: popup
.container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100vh;
z-index: 10;
.popupbg {
position: fixed;
top: 30vh;
left: 30.2%;
z-index: 100;
max-height: 20rem;
overflow: auto;}
VD2: shadow
display: flex
flex-direction: row/column
justyfy-content (for main axis) + align-item (for cross axis)
flex-basis (to change the size of flex items across the main axis. What happends
when we use flex-basis and set flex-direction to column? Flex-basis sets the item's
height): auto (items are only as wide as their content)
flex-grow (to control how a flex item grows across its main axis): 0/1/2(bigger)/...
flex-shrink (designs that shrink are great for smaller devices, like phones. We'll
mimic a smaller screen with a smaller container width. Flex items shrink when
they can't expand to their flex-basis value~we say that a flex item shrinks when its
size is less than its initial flex-basis size):
inline:
height and width don't work on inline elements.
Semantic HTML:
<time>; <address>mail,tel; <header> to define content at the top of the pages;
unlike header and footer, which may contain similar elements across pages,
<main> defines content specific to the particular web page; we use the section
element to define a group of content with a single theme, like the contact
information on this page; <details> hides the text with a widget that must be
toggled to view/hide again, vd: <details><summary>...</summary><p>;
The "contentinfo" role indicates that there's a footer at the end of the page. It
contains copyright, contact, or privacy information.
The "alert" role warns users about events or changes in content, vd: <div
role="alert">Your session will expire in 60 seconds.</div>
form:
<fieldsets> to group related inputs together. Name, mail, phone -> will display a
border around the related elements. Use <legend> inside fieldsets to caption the
entire field set. Vd: <legend>Personal Info</legend>, <legend>Login Info</legend>
display: grid
grid-template-columns: auto auto..../50px 50px 120px/ 1fr 2fr 1fr (short for
fractional unit, chia cột theo phân số)/dùng hàm repeat(3, 1fr) -> 3 columns/
grid-template-rows: 50px 50px 50px (if there are fewer grid items than rows, we'll
get empty rows)
grid-template (define grid rows and colums in one line): 50px 50px (rows)/ 80px
80px (col), can mix unit
string literal
when calling function: functionName`string` = functionName("string")
destructuring
allows us to assign array items to variables to use like any other variable.
...anyOtherVariable sao chép hết toàn bộ các key value, dù nằm xen kẽ giữa key
value cần dùng
the , skips
mở rộng: phía bên trái, có thể mở rộng thuộc tính mới (we can set default values
when we're unsure whether an unpacked element value exists, or is set to
undefined), vd: const [brand, model, enginesQty=1] = ["v1",v2"]
function(arrayName)