Я хочу, чтобы флажки располагались так, как показано на изображении ниже: Обратите внимание, что флажки должны быть размещены с одинаковым вертикальным выравниванием. .feedback {фон: RGB (242 237 241/90%); ...
1 ответ
Измените .burmanRadio__label
на отображение inline-block
вместо inline
по умолчанию, установите для него фиксированную ширину 250px
и установите для text-align
значение right
adjust { Свойства {X6}}, right
, width
и height
в соответствии с макетом, и все готово. Также удалите height: 60%
и используйте вместо него min-height: 60%
, в большинстве случаев это будет лучше.
.feedback {
background: rgb(242 237 241 / 90%);
position: absolute;
width: 90%;
min-height: 60%;
left: 5%;
top: 23%;
display: flex;
justify-content: center;
align-items: stretch;
box-shadow: 0px 2px 4px 4px #000000;
}
.feedback__form {
margin: auto;
padding: 20px;
}
.feedback__form h1 {
font-weight: 700;
margin-bottom: 15px;
}
.burmanRadio {
margin-bottom: 10px;
}
.burmanRadio__input {
display: none;
}
.burmanRadio__input:checked~.burmanRadio__label::after {
opacity: 1;
transform: scale(1);
}
.burmanRadio__label {
cursor: pointer;
line-height: 30px;
position: relative;
text-align: right;
margin-right: 35px;
display: inline-block;
width: 250px;
}
.burmanRadio__label::before,
.burmanRadio__label::after {
border-radius: 50%;
position: absolute;
top: 0px;
right: -45px;
transition: all 0.3s ease-out;
z-index: 2;
}
.burmanRadio__label::before {
content: "";
border: 1.5px solid #E4E4E4;
width: 30px;
height: 30px;
}
.burmanRadio__label::after {
content: "";
background: #7ccc25;
border: 1.5px solid #7BC4CA;
color: #FFF;
font-family: "Material-Design-Iconic-Font";
display: flex;
justify-content: center;
align-items: center;
opacity: 0;
width: 30px;
height: 30px;
transform: scale(0);
}
.burmanRadio__label:hover::before {
border-color: #7BC4CA;
}
<main class="feedback">
<article class="feedback__form">
<h1 class="feedback__question">We wish to know what put you off!</h1>
<div class="burmanRadio">
<input type="radio" class="burmanRadio__input" id="radio-1" name="burmanRadio" checked>
<label for="radio-1" class="burmanRadio__label">Solution was not clear/correct</label>
</div>
<div class="burmanRadio">
<input type="radio" class="burmanRadio__input" id="radio-2" name="burmanRadio">
<label for="radio-2" class="burmanRadio__label">Solution was not available</label>
</div>
<div class="burmanRadio">
<input type="radio" class="burmanRadio__input" id="radio-3" name="burmanRadio">
<label for="radio-3" class="burmanRadio__label">Price is too high</label>
</div>
<div class="burmanRadio">
<input type="radio" class="burmanRadio__input" id="radio-4" name="burmanRadio">
<label for="radio-4" class="burmanRadio__label">Not needed anymore</label>
</div>
<div class="burmanRadio">
<input type="radio" class="burmanRadio__input" id="radio-5" name="burmanRadio">
<label for="radio-5" class="burmanRadio__label">Other reasons</label>
</div>
</article>
</main>
Было бы лучше использовать flexbox и grid.
Изменить: если вам нужно выровнять все параметры вправо, как на изображении, вы можете просто обернуть их в div и правильно выровнять.
.feedback {
background: rgb(242 237 241 / 90%);
position: absolute;
width: 90%;
min-height: 60%;
left: 5%;
top: 23%;
display: flex;
justify-content: center;
align-items: stretch;
box-shadow: 0px 2px 4px 4px #000000;
}
.feedback__form {
padding: 20px;
width: 100%;
text-align: center;
}
.feedback__form h1 {
font-weight: 700;
margin-bottom: 15px;
}
button:active,
:focus {
outline: none !important;
}
.btn {
background-position: center;
border: 0;
border-radius: 3px;
cursor: pointer;
font-family: "Inter", san-serif;
font-weight: 500;
min-width: 120px;
padding: 12px 10px;
margin-bottom: 5px;
white-space: nowrap;
transition: all 0.5s;
}
.options {
text-align: right;
}
.burmanRadio {
margin-bottom: 10px;
}
.burmanRadio__input {
display: none;
}
.burmanRadio__input:checked~.burmanRadio__label::after {
opacity: 1;
transform: scale(1);
}
.burmanRadio__label {
cursor: pointer;
line-height: 30px;
position: relative;
text-align: right;
margin-right: 35px;
display: inline-block;
width: 250px;
}
.burmanRadio__label::before,
.burmanRadio__label::after {
border-radius: 50%;
position: absolute;
top: 0px;
right: -45px;
transition: all 0.3s ease-out;
z-index: 2;
}
.burmanRadio__label::before {
content: "";
border: 1.5px solid #E4E4E4;
width: 30px;
height: 30px;
}
.burmanRadio__label::after {
content: "";
background: #7ccc25;
border: 1.5px solid #7BC4CA;
color: #FFF;
font-family: "Material-Design-Iconic-Font";
display: flex;
justify-content: center;
align-items: center;
opacity: 0;
width: 30px;
height: 30px;
transform: scale(0);
}
.burmanRadio__label:hover::before {
border-color: #7BC4CA;
}
<main class="feedback">
<article class="feedback__form">
<h1 class="feedback__question">We wish to know what put you off!</h1>
<div class="options">
<div class="burmanRadio">
<input type="radio" class="burmanRadio__input" id="radio-1" name="burmanRadio" checked>
<label for="radio-1" class="burmanRadio__label">Solution was not clear/correct</label>
</div>
<div class="burmanRadio">
<input type="radio" class="burmanRadio__input" id="radio-2" name="burmanRadio">
<label for="radio-2" class="burmanRadio__label">Solution was not available</label>
</div>
<div class="burmanRadio">
<input type="radio" class="burmanRadio__input" id="radio-3" name="burmanRadio">
<label for="radio-3" class="burmanRadio__label">Price is too high</label>
</div>
<div class="burmanRadio">
<input type="radio" class="burmanRadio__input" id="radio-4" name="burmanRadio">
<label for="radio-4" class="burmanRadio__label">Not needed anymore</label>
</div>
<div class="burmanRadio">
<input type="radio" class="burmanRadio__input" id="radio-5" name="burmanRadio">
<label for="radio-5" class="burmanRadio__label">Other reasons</label>
</div>
</div>
</article>
</main>
Сделайте свою попытку, прежде чем запрашивать код в следующий раз.
Похожие вопросы
Новые вопросы
javascript
По вопросам программирования на ECMAScript (JavaScript / JS) и его различных диалектах / реализациях (кроме ActionScript). Включите все соответствующие теги в свой вопрос; например, [node.js], [jquery], [json] и т. д.