【问题标题】:CSS align vertical at bottom and centerCSS在底部和中心垂直对齐
【发布时间】:2017-01-30 17:52:36
【问题描述】:

我找到了很多解决方案,但没有一个对我有用。 在以下标记中,文本“lorem ipsum example”应在底部对齐并居中。看不懂!

#box {
		background:#6CCB61	
	}
	.wrapper div {
		height: 240px;
        width:100%;
		margin: 10px 0 20px 0;
		box-sizing:border-box;
		padding: 10px;
		color:white;
		text-align:center;
	}
	#boxGreen span {
		vertical-align: bottom;
	}

	.wrapper {
		width:auto;		
		margin: 0 10px;
	}
	#boxGreen {
		width:100%;	
	}
}
<div class="wrapper">        
        <div id="box">
        	<span>Lorem Ipsum Example</span>
        </div>
</div>

【问题讨论】:

    标签: css vertical-alignment text-alignment


    【解决方案1】:

    试试这个:

    #box {
        background:#6CCB61;
        position: relative;
    }
    
    #box span {
        position: absolute;
        width: 100%;
        left: 0;
        bottom: 0;
    }
    

    https://jsfiddle.net/veefmgna/

    【讨论】:

      猜你喜欢
      • 2018-08-23
      • 1970-01-01
      • 2021-11-03
      • 2018-12-12
      • 2023-01-14
      • 1970-01-01
      • 2016-07-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多