css Bootstrap 5联系表单无响应

ddhy6vgd  于 2023-08-08  发布在  Bootstrap
关注(0)|答案(2)|浏览(117)

我使用Bootstrap 5创建了一个网站,并使用它创建了一个联系表单。当您在台式机或笔记本电脑上查看联系人表单时,将两个部分分开的白色箭头会正确融合。然而,在移动的或平板电脑屏幕上,箭头并不能很好地融入其中。

桌面视图

x1c 0d1x的数据

移动的/平板视图


.form-area {
    padding-top: 7%;
}
.row.single-form {
    box-shadow: 0 2px 20px -5px hsla(0, 0%, 0%, 0.5);
}
.left {
    background: hsl(210, 45%, 30%);
    padding: 200px 98px;
}
.left h2 {
    font-family: 'Montserrat', sans-serif;
    color: hsl(0, 0%, 100%);
    font-weight: 700;
    font-size: 48px;
}
.left h2 span {
    font-weight: 100;
}
.single-form{
    background: hsl(0, 0%, 100%);
}
.right {
    padding: 70px 100px;
    position: relative;
}
.right i {
    position: absolute;
    font-size: 80px;
    left: -27px;
    top: 40%;
    color: hsl(0, 0%, 100%);
}
.form-control {
    border: 2px solid hsl(0, 0%, 0%);
}
.right button {
    border: none;
    border-radius: 0;
    background: hsl(18, 100%, 62%);
    width: 180px;
    color: #fff;
    padding: 15px 0;
    display: inline-block;
    font-size: 16px;
    margin-top: 20px;
    cursor: pointer;
}
.right button:hover{
    background-color: hsl(18, 100%, 62%);
}

/*responsive*/

@media (min-width:768px) and (max-width:991px){
    .right i {
    top: -52px;
    transform: rotate(90deg);
    left: 50%;
}
}

@media (max-width:767px){
    .left {
  padding: 90px 15px;
  text-align: center;
}
.left h2 {
  font-size: 25px;
}
.right {
  padding: 25px;
}
.right i {
  top: -52px;
  transform: rotate(90deg);
  left: 46%;
}
    .right button {
    width: 150px;
    padding: 12px 0;
}
    
}

#info {
    display: flex;
    vertical-align: middle;
}

个字符

bakd9h0s

bakd9h0s1#

当查看为移动的时,箭头元素有top: -52px;,您只需要稍微调整一下。设置top: -50px;使它看起来对我正确

.form-area {
  padding-top: 7%;
}
.row.single-form {
  box-shadow: 0 2px 20px -5px hsla(0, 0%, 0%, 0.5);
}
.left {
  background: hsl(210, 45%, 30%);
  padding: 200px 98px;
}
.left h2 {
  font-family: "Montserrat", sans-serif;
  color: hsl(0, 0%, 100%);
  font-weight: 700;
  font-size: 48px;
}
.left h2 span {
  font-weight: 100;
}
.single-form {
  background: hsl(0, 0%, 100%);
}
.right {
  padding: 70px 100px;
  position: relative;
}
.right i {
  position: absolute;
  font-size: 80px;
  left: -27px;
  top: 40%;
  color: hsl(0, 0%, 100%);
}
.form-control {
  border: 2px solid hsl(0, 0%, 0%);
}
.right button {
  border: none;
  border-radius: 0;
  background: hsl(18, 100%, 62%);
  width: 180px;
  color: #fff;
  padding: 15px 0;
  display: inline-block;
  font-size: 16px;
  margin-top: 20px;
  cursor: pointer;
}
.right button:hover {
  background-color: hsl(18, 100%, 62%);
}

/*responsive*/

@media (min-width: 768px) and (max-width: 991px) {
  .right i {
    top: -50px; /* THIS LINE WAS CHANGED */
    transform: rotate(90deg);
    left: 50%;
  }
}

@media (max-width: 767px) {
  .left {
    padding: 90px 15px;
    text-align: center;
  }
  .left h2 {
    font-size: 25px;
  }
  .right {
    padding: 25px;
  }
  .right i {
    top: -50px; /* THIS LINE WAS CHANGED */
    transform: rotate(90deg);
    left: 46%;
  }
  .right button {
    width: 150px;
    padding: 12px 0;
  }
}

#info {
  display: flex;
  vertical-align: middle;
}

个字符

4xrmg8kj

4xrmg8kj2#

另外一个想法是,你也可以通过在右边的列后面添加一个CSS方块,然后根据需要旋转它来实现类似的结果。这可以简化大小调整和放置问题。
请检查这个:https://codepen.io/panchroma/pen/YzRMgpz
我已经注解掉了你的插入符号,并在第90行添加了这个新的CSS

/* Create a pseudo-element sqaure after the .right element */

/* default styling, pointing up on mobile and tablet  */
.right::after {
  content: "";
  height: 40px;
  width: 40px;
  position: absolute;
  background-color: white;
  /*  background-color: pink; */ /* set colour to pink for debugging */
  top: -20px;
  left: calc(50% - 20px);
  transform: rotate(45deg);
}

/* on tablet and desktop, point to left */
@media (min-width: 992px) {
  .right::after {
    top: 40%;
    left: -20px;
  }
}

字符串

相关问题