简体   繁体   English

为组合字段集提供边框

[英]Give border to combined fieldset

I've tried making a fieldset with the react app but it seemed difficult so i managed to make it look like with some css, and now i'm pretty curious about how to border the comlpete box just like this我试过用 react 应用程序制作一个字段集,但它似乎很困难,所以我设法让它看起来像一些 css,现在我很好奇如何像这样边界完整框图像1

  <div class="fieldset">
    <div class="legend">Text</div>
    Text2
  </div>

Customised Styles:定制 Styles:

  .fieldset{
    width: 200px;
    height: 300px;
    border: 1px solid black;
    padding: 30px;
    margin: 30px;
    position: relative;
  }
  .legend{
    font-size: 45px;
    position: absolute;
    top: -8%;
    left: 50%;
    transform: translate(-50%);
    background: #fff;
  }

this way you can goes near your goal.这样你就可以接近你的目标。 Hope it's work for you.希望它对你有用。

 .fieldset{ border: 1px solid black; padding: 30px; margin: 100px 30px 30px; position: relative; font-size: 45px; width: 200px; border-radius: 10px; }.legend{ position: absolute; width: fit-content; top: -74px; left: 0; right: 0; margin: 0 auto; padding: 10px; border: 1px solid #000; border-bottom: 1px solid #fff; border-radius: 10px 10px 0 0; }
 <div class="fieldset"> <div class="legend">Title</div> Content </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM