首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >创建上面的页脚- css/html

创建上面的页脚- css/html
EN

Stack Overflow用户
提问于 2021-07-12 22:56:23
回答 1查看 71关注 0票数 0

我需要一些CSS的帮助。我试图在页脚上方创建一个条纹,在那里,我在桌面上有左边的图像,旁边的文本,然后右边的表单输入字段和按钮。我已经附上了当前桌面外观的问题是,我希望文本旁边的图像垂直在中间和表单字段在右边更多。

当前桌面:

对于移动:我希望文本显示在图像的旁边(可以分成两行),它们的表单字段向上移动,所以它在图像和文本下面。

流动电话:

有人能帮上忙吗?

HTML:

代码语言:javascript
复制
<div id="text-5">

    <div class="left_footer_strip"><img src="https://shop.balancecoffee.co.uk/wp-content/uploads/2021/07/ezgif.com-gif-maker-1.gif" alt="Join Balance"/></div>
    
    <p class="middle_footer_strip">Join Balance and get 20% off your first order</p>
    
    //form fields
    <div class="klaviyo-form-Re6W9v right_footer_strip"></div>

</div>

CSS:

/页脚/

代码语言:javascript
复制
#text-5{
    width:100% !important;
}

.footer_wrap_inner > .content_wrap{
    width:100% !important;
}

.left_footer_strip,
.middle_footer_strip{
    float:left;
}

.left_footer_strip{
    padding-right:20px;
}

.middle_footer_strip{
    font-size:24px !important;
}
EN

回答 1

Stack Overflow用户

发布于 2021-07-12 23:17:50

您可以使用CSS Flexbox:

代码语言:javascript
复制
#text-5 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2em;
}
#text-5 > * {
  flex-basis: 40%;
}
.form {
  display: flex;
}

@media screen and (min-width: 1000px) {
  #text-5 {
    flex-wrap: nowrap;
  }
}
代码语言:javascript
复制
<div id="text-5">
  <img 
    src="https://shop.balancecoffee.co.uk/wp-content/uploads/2021/07/ezgif.com-gif-maker-1.gif" 
    alt="Join Balance" 
  />
  <p>Join Balance and get 20% off your first order</p>
  <form class="form">
    <input type="text" value="Enter first name" />
    <input type="email" value="Enter email" />
    <input type="submit" value="SUBMIT" />
  </form>
</div>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68354652

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档