scss CSS:水平对齐列表项

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss CSS:水平对齐列表项相关的知识,希望对你有一定的参考价值。

ul.nav {
	-ms-text-justify: distribute-all-lines;
	overflow: hidden;
	text-align: justify;
	text-justify: distribute-all-lines;

	li {
		@include inline-block();
	}

	// this :after is sort-of a hack to justify the li in .nav
	// > short explanation: 
	//   the li are 'inline-block' and can therefore be justified via 'justify'.
	//   but: justification happens for every *line* except the last one, which is left-aligned.
	//   hence the need to have an additional line, which is provided by :after.
	//   it takes up a whole line (width: 100%) and is invisible due to it's font-size and line-height of 0
	// source: http://stackoverflow.com/questions/6865194/fluid-width-with-equally-spaced-divs
	&:after {
		@include inline-block();
		content: '';
		font-size: 0;
		line-height: 0;
		width: 100%;
	}

}

以上是关于scss CSS:水平对齐列表项的主要内容,如果未能解决你的问题,请参考以下文章

列表项的水平对齐/对齐?

scss 垂直和水平对齐SASS mixin

对齐中心CSS中的单个列表项

text 只需一行SCSS就可以垂直和水平对齐或只是垂直对齐,它同时支持两者。

text 只需一行SCSS就可以垂直和水平对齐或只是垂直对齐,它同时支持两者。

css 将第二行列表项与第一行对齐