LoginSignup
0
0

More than 1 year has passed since last update.

CSSで途中線が切れているボックスを描く

Posted at

友人から初めてサイトのコーディング依頼を受けて喜んでいたら
凄く悩むところがあったので、友人への恨みとスキルアップの喜びを
込めて記事に残しておきます。

友人から届いたサイトデザインの一部
スクリーンショット 2021-05-09 21.42.51.png

なんだ普通のボックスやん!簡単、簡単
、、、、
スクリーンショット 2021-05-09 21.42.51.png

なんか途中で切れてるんですけど
そこから半日格闘!!

正しいやり方かどうかはわかりませんが、以下のような方法でできました。

index.html
          <div class="contact-form-box contact-form-centerbox">
            <div class="flex contact-form-address">
              <p>
                500 Terry Francois St.<br />
                San Francisco<br />CA 94158
              </p>
            </div>
          </div>
style.css
.flex {
  display: flex;
  justify-content: center;
  align-items: center;
}
.contact-form-box{
  max-width: 320px;
  width: calc(100%/3);
  height: 300px;
}
.contact-form-address{
  /* ここで枠線の高さを変えている */
  height: 90%;
  width: 100%;
  box-sizing: border-box;
  border-right: 1px solid;
  border-left: 1px solid;
}
.contact-form-address{
  height: 90%;
  width: 100%;
  box-sizing: border-box;
  border-right: 1px solid;
  border-left: 1px solid;
}

結果
(SNSのアイコンが違うのは見なかった事に)
スクリーンショット 2021-05-09 21.56.06.png

positin:absolute;
top:-10px;
とか色々試したんですがうまくいかず、この方法でなんとかできました。
他に何か良い方法があればご教授いただきたいです。

ここまで読んでいただきありがとうございました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0