我希望有人能帮助我得到这两个复选框与文本并排,而不是顶部/底部.

谢谢!

https://jsfiddle.net/j8y1x7q9/

    <div class="checkbox-wrapper-33">
  <label class="checkbox">
    <input class="checkbox__trigger visuallyhidden" name="WAV" type="checkbox" checked />
    <span class="checkbox__symbol">
      <svg aria-hidden="true" class="icon-checkbox" width="28px" height="28px" viewBox="0 0 28 28" version="1" xmlns="http://www.w3.org/2000/svg">
        <path d="M4 14l8 7L24 7"></path>
      </svg>
    </span>
    <p class="checkbox__textwrapper">WAV</p>
  </label>
  <label class="checkbox">
    <input class="checkbox__trigger visuallyhidden" name="MP3" type="checkbox" />
    <span class="checkbox__symbol">
      <svg aria-hidden="true" class="icon-checkbox" width="28px" height="28px" viewBox="0 0 28 28" version="1" xmlns="http://www.w3.org/2000/svg">
        <path d="M4 14l8 7L24 7"></path>
      </svg>
    </span>
    <p class="checkbox__textwrapper">MP3</p>
  </label>
</div>

推荐答案

在父组件.checkbox-wrapper-33中添加一个flex

看看这个例子:

.checkbox-wrapper-33 {
  display: flex;
  justify-content: start;
}

这将是在代码中添加flexbox后的输出:

.checkbox-wrapper-33 {
  display: flex;
  justify-content: start;
}

.checkbox-wrapper-33 {
  --s-xsmall: 0.625em;
  --s-small: 1.2em;
  --border-width: 1px;
  --c-primary: #3a3a3c;
  --c-primary-20-percent-opacity: rgb(55 55 55 / 20%);
  --c-primary-10-percent-opacity: rgb(55 55 55 / 10%);
  --t-base: 0.4s;
  --t-fast: 0.2s;
  --e-in: ease-in;
  --e-out: cubic-bezier(.11, .29, .18, .98);
}

.checkbox-wrapper-33 .visuallyhidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

.checkbox-wrapper-33 .checkbox {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.checkbox-wrapper-33 .checkbox+.checkbox {
  margin-left: var(--s-small);
}

.checkbox-wrapper-33 .checkbox__symbol {
  display: inline-block;
  display: flex;
  margin-right: calc(var(--s-small) * 0.7);
  border: var(--border-width) solid var(--c-primary);
  position: relative;
  border-radius: 0.1em;
  width: 1.5em;
  height: 1.5em;
  transition: box-shadow var(--t-base) var(--e-out), background-color var(--t-base);
  box-shadow: 0 0 0 0 var(--c-primary-10-percent-opacity);
}

.checkbox-wrapper-33 .checkbox__symbol:after {
  content: "";
  position: absolute;
  top: 0.5em;
  left: 0.5em;
  width: 0.25em;
  height: 0.25em;
  background-color: var(--c-primary-20-percent-opacity);
  opacity: 0;
  border-radius: 3em;
  transform: scale(1);
  transform-origin: 50% 50%;
}

.checkbox-wrapper-33 .checkbox .icon-checkbox {
  width: 1em;
  height: 1em;
  margin: auto;
  fill: none;
  stroke-width: 3;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-miterlimit: 10;
  color: var(--c-primary);
  display: inline-block;
}

.checkbox-wrapper-33 .checkbox .icon-checkbox path {
  transition: stroke-dashoffset var(--t-fast) var(--e-in);
  stroke-dasharray: 30px, 31px;
  stroke-dashoffset: 31px;
}

.checkbox-wrapper-33 .checkbox__textwrapper {
  margin: 0;
}

.checkbox-wrapper-33 .checkbox__trigger:checked+.checkbox__symbol:after {
  -webkit-animation: ripple-33 1.5s var(--e-out);
  animation: ripple-33 1.5s var(--e-out);
}

.checkbox-wrapper-33 .checkbox__trigger:checked+.checkbox__symbol .icon-checkbox path {
  transition: stroke-dashoffset var(--t-base) var(--e-out);
  stroke-dashoffset: 0px;
}

.checkbox-wrapper-33 .checkbox__trigger:focus+.checkbox__symbol {
  box-shadow: 0 0 0 0.25em var(--c-primary-20-percent-opacity);
}

@-webkit-keyframes ripple-33 {
  from {
    transform: scale(0);
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: scale(20);
  }
}

@keyframes ripple-33 {
  from {
    transform: scale(0);
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: scale(20);
  }
}
<div class="checkbox-wrapper-33">
  <label class="checkbox">
        <input class="checkbox__trigger visuallyhidden" name="WAV" type="checkbox" checked />
        <span class="checkbox__symbol">
          <svg aria-hidden="true" class="icon-checkbox" width="28px" height="28px" viewBox="0 0 28 28" version="1" xmlns="http://www.w3.org/2000/svg">
            <path d="M4 14l8 7L24 7"></path>
          </svg>
        </span>
        <p class="checkbox__textwrapper">WAV</p>
      </label>
  <label class="checkbox">
        <input class="checkbox__trigger visuallyhidden" name="MP3" type="checkbox" />
        <span class="checkbox__symbol">
          <svg aria-hidden="true" class="icon-checkbox" width="28px" height="28px" viewBox="0 0 28 28" version="1" xmlns="http://www.w3.org/2000/svg">
            <path d="M4 14l8 7L24 7"></path>
          </svg>
        </span>
        <p class="checkbox__textwrapper">MP3</p>
      </label>
</div>

Html相关问答推荐

HTML横幅未正确对齐页面顶部

我已经在我的网站上创建了按钮,但我不能让它们正确排列.'

我需要主页按钮出现在中间

为所有必填字段添加所需的占位符文本(Angular Material)

我无法使用背景图像css,因为我在VS代码中将照片放在不同的文件夹中

在每个列宽由带有固定值的minmax()函数定义的网格中,CSS如何为列分配空间?

如何从多个TO中获取一个范围标记以溢出其父标记

将精选选项的价格合并为一个价格HTML、PHP和JQuery

如何从通过 find-each 方法(在 Rails 应用程序中)生成的列表创建下拉菜单?

在 html 和 css 中绘制表格内的倾斜线

停止 Bootstrap 5 输入调整 CSS 网格单元的高度

在span中添加

即使必填字段为空,HTML 表单也已成功提交

排列卡片时遇到困难

HTML 如何根据屏幕尺寸调整/裁剪视频背景?

什么没有 margin-right 和 width:100% 溢出子元素到左边?

单击时 HTML 锚元素不重定向到相对路径

如何在滚动行中显示一张图片和下一张图片的一半?

将固定/绝对伪元素放置在相对 div(具有滚动条)内,始终位于底部

所有幻灯片上的 Quarto RevealJS 标题