Skip to content

Instantly share code, notes, and snippets.

@337547038
Created June 1, 2018 01:34
Show Gist options
  • Save 337547038/c82ae9d9eda50c5088357adfb1d0fe26 to your computer and use it in GitHub Desktop.
Save 337547038/c82ae9d9eda50c5088357adfb1d0fe26 to your computer and use it in GitHub Desktop.
CSS如何实现文字两端对齐
在排版表单字段时,很多时间字数不一,如下:
用户名:
密码:
手机号码:
要实现前面的文字两端对齐,有个傻傻的办法就是在文字中间用空格隔开;
解决办是:
<div>用户名:</div>
css如下:
div{ text-align:justify; width:100px;}
div:after{ display:inline-block;width:100%;content:""}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment