C
C
chirihachirini2021-07-14 22:49:33
HTML
chirihachirini, 2021-07-14 22:49:33

Does what I wrote look like BEM code?

Hello! I am the most beginner of beginners, trying to master BEM (and not only BEM, but in general layout as such). There are one and a half layout designers in my environment - and those Junes, so I came with my question to you, dear inhabitants of the Habr community. I duplicate the question in the title: does what I wrote look like code written in BEM? Or "everything is bullshit, redo it"

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Shoe</title>
</head>
<body>
    <link rel="stylesheet" href="reset.css">
    <link rel="stylesheet" href="style.css">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:[email protected];500;700&display=swap" rel="stylesheet">
    <div class="main-container">
        <header class="header">
             <div class="logo"><img src="images/logo.png" alt="Logo"></div>
             <div class="header-menu"><img src="images/menu.png" alt="Menu"></div>
        </header>
        <div class="main-container">
         <img class="main-container-picture" src="images/bg.png" alt="Background">
         <div class="main-container-block-1">
             <div class="main-container-block-1-content">
                 <div class="main-container-block-1-content-text">
                     <p>Your Title Goes Here Make It Long & Maybe 3 Lines</p>
                </div>
                     <div class="main-container-block-1-content-buttons">
                     <div class="btn"><a class="btn-link" href="#">explore</a></div>
                     <div class="btn"><a class="btn-link" href="#">Add to cart</a></div>
                   </div>
                </div>
             </div>
        </div>
    </div>
</body>
</html>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Pershin, 2021-07-14
@chirihachirini

It's not BEM at all. You should have got something like this:

<div class="main-container">
    <img class="main-container__picture" src="images/bg.png" alt="Background">
    <!-- main-container__block-1 block-1 - Это микс, блок который модифицируется элементом другого блока или другим блоком  -->
    <div class="main-container__block-1 block-1">
        <div class="block-1__content">
            <div class="block-1__text">
                <p>Your Title Goes Here Make It Long & Maybe 3 Lines</p>
            </div>
            <div class="block-1__buttons">
                <!-- block-1__btn btn - Это тоже микс  -->
                <div class="block-1__btn btn"><a class="btn__link" href="#">explore</a></div>
                <div class="block-1__btn btn"><a class="btn__link" href="#">Add to cart</a></div>
            </div>
        </div>
    </div>
</div>

J
jIVOYz, 2021-07-14
@jIVOYz

I don't really know how to write the BEM method myself, but they seemed to say that instead of a hyphen, you need to use a double underscore, like:
main__btn
Correct if it's wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question