верстка двух блоков css
при размещении 2 блоков через li они просто исчезают, как исправить?
* {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
background: linear-gradient(145.59deg, #29FF8C -19.48%, #3AC1A8 22.2%, #7000FF 133.44%, #7ECAE2 137.8%);
background-size: cover;
background-attachment: fixed;
}
li {
display: inline-block;
}
.nav {
display: block;
margin-left: 100px;
}
.nav-btn {
display: block;
height: 45px;
width: 100%;
color: #fff;
padding-top: 10px;
font-family: Oswald;
font-style: normal;
font-weight: normal;
text-align: center;
font-size: 23px;
line-height: 32px;
text-decoration: none;
margin-bottom: 30px;
justify-content: center;
text-align: center;
border-bottom-left-radius: 12px;
border-bottom-right-radius: 12px;
transition: 0.4s;
margin-right: 110px;
}
.nav-btn:hover,
.nav-btn:active {
background: rgba(255, 255, 255, 0.7);
color: #778ed5;
}
.enter {
display: block;
color: #fff;
padding-top: 10px;
font-family: Oswald;
font-style: normal;
font-weight: normal;
text-align: center;
font-size: 21px;
line-height: 32px;
text-decoration: none;
margin-bottom: 30px;
justify-content: center;
text-align: center;
border-bottom-left-radius: 12px;
border-bottom-right-radius: 12px;
margin-left: 410px;
transition: 0.4s;
text-decoration: none;
}
.enter:hover,
.enter:active {
color: #32E19B;
}
.reg_btn {
display: block;
margin-left: 30px;
color: #fff;
background: #29FF8C;
width: 150px;
height: 40px;
border-radius: 15px;
border-style: none;
border-color: none;
transition: 0.4s;
font-family: Oswald;
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 32px;
text-decoration: none;
box-shadow: 2px 2px 1px 1px rgba(41, 255, 140, 0.4);
}
.reg_btn:hover,
.reg_btn:active {
background: #23C66E;
box-shadow: 2px 2px 2px 2px rgba(41, 255, 140, 0.4);
}
.main-block {
display: block;
margin-right: auto;
margin-left: auto;
width: 95%;
height: 88%;
background: #fff;
border-radius: 12px;
}
.block-with-img-and-title {
display: block;
width: 32%;
height: 100%;
background: red;
border-top-left-radius: 12px;
border-bottom-left-radius: 12px;
}
.main-block {
display: flex;
}
.a {
display: inline-block;
}
.text-block {
display: block;
width: 68%;
height: 100%;
background: green;
}
<div class="nav">
<li>
<div class="nav-btn">рецепты</div>
</li>
<li>
<div class="nav-btn">Избранные</div>
</li>
<li>
<div class="nav-btn">Создать</div>
</li>
<li><a class="enter" href="#">рецепты</a></li>
<li><button class='reg_btn'>Регистрация</button></li>
</div>
<div class="main-block">
<li class="a">
<div class="block-with-img-and-title"></div>
</li>
<li class="a">
<div class="text-block"></div>
</li>
</div>
Ответы (2 шт):
Автор решения: Vladyslav
→ Ссылка
Пропиши что то внутрь и они появятся
<div class = "main-block">
<li class = "a"><div class = "block-with-img-and-title">123</div></li>
<li class = "a"><div class = "text-block">123</div></li>
</div>
Автор решения: Иван Ипатов
→ Ссылка
Если честно, не особо понял что вам нужно, так что сделал как на картинке
@import url('https://fonts.googleapis.com/css2?family=Oswald&display=swap');
* {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
background: linear-gradient(145.59deg, #29FF8C -19.48%, #3AC1A8 22.2%, #7000FF 133.44%, #7ECAE2 137.8%);
background-size: cover;
background-attachment: fixed;
}
li {
display: inline-block;
}
.nav {
display: block;
margin-left: 100px;
}
.nav-btn {
display: block;
height: 45px;
width: 100%;
color: #fff;
padding-top: 10px;
font-family: Oswald;
font-style: normal;
font-weight: normal;
text-align: center;
font-size: 23px;
line-height: 32px;
text-decoration: none;
margin-bottom: 30px;
justify-content: center;
text-align: center;
border-bottom-left-radius: 12px;
border-bottom-right-radius: 12px;
transition: 0.4s;
margin-right: 110px;
}
.nav-btn:hover,
.nav-btn:active {
background: rgba(255, 255, 255, 0.7);
color: #778ed5;
}
.enter {
display: block;
color: #fff;
padding-top: 10px;
font-family: Oswald;
font-style: normal;
font-weight: normal;
text-align: center;
font-size: 21px;
line-height: 32px;
text-decoration: none;
margin-bottom: 30px;
justify-content: center;
text-align: center;
border-bottom-left-radius: 12px;
border-bottom-right-radius: 12px;
margin-left: 410px;
transition: 0.4s;
text-decoration: none;
}
.enter:hover,
.enter:active {
color: #32E19B;
}
.reg_btn {
display: block;
margin-left: 30px;
color: #fff;
background: #29FF8C;
width: 150px;
height: 40px;
border-radius: 15px;
border-style: none;
border-color: none;
transition: 0.4s;
font-family: Oswald;
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 32px;
text-decoration: none;
box-shadow: 2px 2px 1px 1px rgba(41, 255, 140, 0.4);
}
.reg_btn:hover,
.reg_btn:active {
background: #23C66E;
box-shadow: 2px 2px 2px 2px rgba(41, 255, 140, 0.4);
}
.main-block {
display: flex;
margin-right: auto;
margin-left: auto;
width: 95%;
height: 88%;
background: #fff;
border-radius: 12px;
}
.block-with-img-and-title {
display: flex;
position: relative;
width: 30vw;
align-items: center;
flex-direction: column;
gap: 20px;
margin-top: 20%;
}
.a {
display: inline-block;
position: relative;
}
.text-block {
display: flex;
justify-content: center;
width: 70vw;
margin-top: 20px;
height: 100%;
font: normal 32px Oswald;
}
.circle {
border-radius: 50%;
width: 250px;
height: 250px;
background-color: #C4C4C4;
}
h4 {
font: normal 32px Oswald;
}
hr {
position: absolute;
height: 650px;
width: 10px;
border: none;
background: linear-gradient(145.59deg, #7ECAE2 -19.48%, #7000FF 22.2%, #3AC1A8 133.44%, #29FF8C 137.8%);
top: 0;
right: -40px;
transform: rotate(180deg);
}
<div class="nav">
<li>
<div class="nav-btn">Рецепты</div>
</li>
<li>
<div class="nav-btn">Избранные</div>
</li>
<li>
<div class="nav-btn">Создать</div>
</li>
<li><a class="enter" href="#">Рецепты</a></li>
<li><button class='reg_btn'>Регистрация</button></li>
</div>
<div class="main-block">
<li class="a">
<div class="block-with-img-and-title">
<div class="circle"></div>
<h4>Жареная курица</h4>
</div>
<hr />
</li>
<li class="a">
<div class="text-block">Основное</div>
</li>
</div>
