Skip to content

TASK-1 create square, circle, ellipse and triangle#1

Open
pollyv wants to merge 1 commit intomainfrom
TASK-1
Open

TASK-1 create square, circle, ellipse and triangle#1
pollyv wants to merge 1 commit intomainfrom
TASK-1

Conversation

@pollyv
Copy link
Copy Markdown
Owner

@pollyv pollyv commented May 28, 2024

A simple HTML/CSS code has been created that displays various shapes (square, circle, ellipse, triangle) in a flexible container located in the center of the web page both vertically and horizontally. Each shape has its own CSS class that defines its appearance, such as color and size. In addition, the effect of hovering the mouse cursor over the shapes has been added (the color of the shape changes when hovering).

Comment thread index.html
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="container">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хотелось бы, чтобы верстка смотрелась красиво в том числе и на планшетных/мобильных разрешениях, даже если это первое задание учебного проекта ;)

Comment thread index.html
<div class="shape square"></div>
<div class="shape circle"></div>
<div class="shape ellipse"></div>
<div class="shape triangle"></div>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

При стилизации компонентов в данном задании (да и во всех остальных тоже) необходимо использовать методологию БЭМ, в теоретических материалах к этому модулю https://docs.google.com/document/d/1cF6Ho0bRKAPAcIuoBJTeYq9VIVL-q5p8dI3_TyhHncI/edit была такая глава, так что уверена, что не нужно объяснять, что это и для чего используется, но если вдруг что-то непонятно, можешь написать в телеграм.
В данном случае shape является у тебя Б - блоком, в котором присутствуют общие стили всех фигур, а square, circle итд - М - модификаторы, в которых уже содержатся уникальные стили каждой конкретной фигуры. Модификаторы в БЭМ обозначаются с помощью двойного дефиса, т.е. по логике БЭМ названия классов должны выглядеть так: "shape shape--square", "shape shape--circle" итд

Comment thread styles.css
height: 100px;
display: flex;
justify-content: center;
align-items: center;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я думаю, стили на 18-20 строках здесь лишние, внутри фигур нечего центровать и если эти стили убрать - ничего не изменится.
Так же хотелось бы увидеть стили для сглаживания(transition) перехода между состояниями обычным и наведения(hover), сейчас переход выглядит очень резким

Comment thread styles.css
}

.shape:hover {
cursor: pointer;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет смысла писать свойство cursor внутри псевдокласса :hover т.к это свойство само по себе будет срабатывать в том числе и при наведении курсора, при условии, что оно добавлено в "дефолтное" состояние класса(в данном случае .shape), так что стоит это свойство перенести в .shape

Comment thread styles.css
background-color: #ffff00;
}

.square {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

С точки зрения методологии БЭМ ошибочно в класс с названием square добавлять стили, которые влияют не на форму фигуры, а на цвет. Соответственно, в данном случае название класса должно быть именовано по цвету.

Comment thread styles.css
}

.circle {
background-color: #0000ff;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут та же ошибка, необходимо разделить на 2 модификатора, первый - со стилями фигуры, второй - по цвету

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants