Skip to content

Feedback entrytask 2 #1

@hnngo

Description

@hnngo
  1. Khi viết css, nên tránh dùng html tag và anh không khuyến khích dùng loose selector như là > ~ +.
.user > h1{
    color: #eb5757;
}

.user > p{
    color: black;
    font-size: 25px;
}

.user .username{
    color: #f2994b;
}

.user > h2{
    color: #2f80ed;
}

Ví dụ nếu trong div.user mà mình add thêm 1 h1 thì nó cũng sẽ bị ảnh hưởng do dòng đầu css em viết.
Anh gợi ý cứ đặt class cho element mình cần style. Ví dụ, em có thể thêm 1 class label cho mỗi p tag thì giờ em đổi css thành .user .label. Tuy dài hơn nhưng ít dẫn đến lỗi hơn khi mình mở rộng code.

            <div className="user">
                <h1 className="name"> { user.name } </h1>
                <p className="label username"> { user.username } </p>
                <h2 className="company"> { user.company.name } </h2>
                <p className="label email">  
                    <img src={email} width = {size} height={size}/>
                    { user.email }
                </p>
                <p className="label adress">
                    <img src={address} width = {size} height={size}/>
                    { user.address.street+", "+user.address.suite+", "+user.address.city+", "+user.address.zipcode }
                </p>
                <p className="label phone">  
                    <img src={phone} width = {size} height={size}/>
                    { user.phone }
                </p>
                <p className="label website">  
                    <img src={website} width = {size} height={size}/>
                    { user.website }
                </p>
            </div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions