Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ошибка в приложенном коде #878

Open
pawwvw opened this issue Dec 2, 2024 · 0 comments
Open

Ошибка в приложенном коде #878

pawwvw opened this issue Dec 2, 2024 · 0 comments

Comments

@pawwvw
Copy link

pawwvw commented Dec 2, 2024

https://ru.bem.info/methodology/css/#dry

В разделе описывается принцип DRY в БЭМ.

Как неправильный представлен код:

HTML

<button class="button">...</button>
<button class="btn">...</button>

CSS

.button {
    font-family: Arial, sans-serif;
    text-align: center;
    color: #000;
    background: #fff;
}

.btn {
    font-family: Arial, sans-serif;
    text-align: center;
    color: #000;
    background: rgba(255, 0, 0, 0.4);
}

image

А как правильный:

HTML

<button class="button button_theme_islands">...</button>
<button class="button button_theme_simple">...</button>

CSS

.button {
    font-family: Arial, sans-serif;
    text-align: center;
}

.button_theme_islands {
    color: #000;
    background: #fff;
}

.button_theme_simple {
    color: #000;
    background: rgba(255, 0, 0, 0.4);
}

image

Что, кажется, не совсем соответствует принципам DRY

Возможно вы имели ввиду:

CSS

.button {
    font-family: Arial, sans-serif;
    text-align: center;
    color: #000;
}

.button_theme_islands {
    background: #fff;
}

.button_theme_simple {
    background: rgba(255, 0, 0, 0.4);
}
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

No branches or pull requests

1 participant