对齐div底部的按钮

问题描述 投票:1回答:1

我需要做同样的片段,但在qazxsw poi没有高度

.footer
.footer {
  background: blue;
  width: 1200px;
  height: 250px; //I NEED TO CHANGE THIS
}

.footer .container {
  width: 100%;
  height: 100%;
  margin: 0 auto;
}

.footer .container .col-25 {
  width: 25%;
  float: left;
  box-sizing: border-box;
  height: 100%;
  padding: 0 30px;
}

.footer .container .col-25 .footer-col {
  color: #fff;
  height: 100%;
  display: inline-block;
  position: relative;
}

.footer .container .col-25 .footer-col h2 {
  font-size: 18px;
}

.footer .container .col-25 .footer-col input[type="button"] {
  font-size: 16px;
  color: #3da6cc;
  background: #fff;
  padding: 10px;
  width: 100%;
  border: none;
  border-radius: 3px;
  position: absolute;
  bottom: 10px;
}

.footer .container .col-25 .footer-col.present .text-centered-y {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.footer .container .col-25 .footer-col.present .text-centered-y h1 {
  font-style: italic;
}

.footer .container .col-25 .footer-col.present .text-centered-y h1 span {
  color: #29738e;
}

.footer .container .col-25 .footer-col.present .text-centered-y h3 {
  font-weight: lighter;
}
css css3 position
1个回答
3
投票

这是代码。即使你不需要设置高度。或者你也可以改变。或者您可以扩展段落/内容

<div class="footer">
			<div class="container">
				<div class="col-25">
					<div class="footer-col">
						<h2>Lorem Ipsum</h2>
						<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud...</p>
						<input type="button" value="Lorem Ipsum" />
					</div>
				</div>
        <div class="col-25">
					<div class="footer-col">
						<h2>Lorem Ipsum</h2>
						<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud...</p>
						<input type="button" value="Lorem Ipsum" />
					</div>
				</div>
				<div class="col-25">
					<div class="footer-col">
						<h2>Lorem Ipsum</h2>
						<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud...</p>
						<input type="button" value="Lorem Ipsum" />
					</div>
				</div>
				<div class="col-25">
					<div class="footer-col">
						<h2>Lorem Ipsum</h2>
						<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
						<input type="button" value="Lorem Ipsum" />
					</div>
				</div>
			</div>
		</div>
.footer {
  background: blue;
  width: 1200px;
}

.footer .container {
  width: 100%;
  height: 100%;
  margin: 0 auto;
  display: flex;
}

.footer .container .col-25 {
  width: 25%;
  box-sizing: border-box;
  padding: 0 30px;
  padding-bottom: 50px;
}

.footer .container .col-25 .footer-col {
  color: #fff;
  height: 100%;
  display: inline-block;
  position: relative;
}

.footer .container .col-25 .footer-col h2 {
  font-size: 18px;
}

.footer .container .col-25 .footer-col input[type="button"] {
  font-size: 16px;
  color: #3da6cc;
  background: #fff;
  padding: 10px;
  width: 100%;
  border: none;
  border-radius: 3px;
  position: absolute;
  top: 100%;
}

.footer .container .col-25 .footer-col.present .text-centered-y {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.footer .container .col-25 .footer-col.present .text-centered-y h1 {
  font-style: italic;
}

.footer .container .col-25 .footer-col.present .text-centered-y h1 span {
  color: #29738e;
}

.footer .container .col-25 .footer-col.present .text-centered-y h3 {
  font-weight: lighter;
}
© www.soinside.com 2019 - 2024. All rights reserved.