【问题标题】:Three captions of same size inside of a div elementdiv元素内三个相同大小的标题
【发布时间】:2018-03-27 18:29:28
【问题描述】:

我想做一个div的布局,里面有3个标题大小一样!

我正在使用 angular materialize - 普通 html / css 也适用于我。

我试过了

<div>
 <label> Label 1 </label>
 <label> Label 2 </label>
 <label> Label 3 </label>
</div>

我附上了我需要的图片。

我应该在里面使用相同的 3 个 div 吗?或跨度/标签?

【问题讨论】:

  • div、label、span、p 和许多其他标签都适用于布局。唯一的事情是你应该正确地设计它。并且使用有意义的元素将提高您的代码质量。

标签: html css angular material-design


【解决方案1】:

这是你需要的。

.tabs label {
    padding: 10px 20px;
    border-left: 1px solid #ccc;
    border-right: 0;
    float: left;
}
label.selected {
    background: #ccc;
}
.tabs label:first-child {
    border-left: 0;
}

.tabs {
    margin: 10px;
    display: inline-block;
    border: 1px solid #ccc;
    border-radius: 20px;
    overflow:hidden;
}
<div class="tabs">
 <label class="selected"> Label 1 </label>
 <label> Label 2 </label>
 <label> Label 3 </label>
</div>

【讨论】:

  • 嘿,非常感谢 Awsme 桑迪!它对我来说工作得很好:)
  • @CodeWithCoffee 谢谢,请不要忘记标记它有帮助:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-30
  • 1970-01-01
  • 1970-01-01
  • 2023-03-31
相关资源
最近更新 更多