解决用户昵称过长时出现的样式错误 codereview 赵彪
Showing
2 changed files
with
12 additions
and
2 deletions
@@ -140,7 +140,7 @@ function reMarginFooter(fixedElement) { | @@ -140,7 +140,7 @@ function reMarginFooter(fixedElement) { | ||
140 | 140 | ||
141 | //已登录 | 141 | //已登录 |
142 | $op.prepend( | 142 | $op.prepend( |
143 | - 'Hi,' + | 143 | + '<span>Hi,</span>' + |
144 | '<a class="user-name" href="http://m.yohobuy.com/home?tmp=' + Math.random() + '">' + user[0] + '</a>' + | 144 | '<a class="user-name" href="http://m.yohobuy.com/home?tmp=' + Math.random() + '">' + user[0] + '</a>' + |
145 | '<a href="http://m.yohobuy.com/passport/signout/index?token=' + user[3] + '">退出</a>' | 145 | '<a href="http://m.yohobuy.com/passport/signout/index?token=' + user[3] + '">退出</a>' |
146 | ); | 146 | ); |
@@ -7,11 +7,21 @@ | @@ -7,11 +7,21 @@ | ||
7 | padding: 0 15px; | 7 | padding: 0 15px; |
8 | height: 60px; | 8 | height: 60px; |
9 | line-height: 60px; | 9 | line-height: 60px; |
10 | - | 10 | + span{ |
11 | + display: inline-block; | ||
12 | + overflow:hidden; | ||
13 | + } | ||
14 | + a{ | ||
15 | + display: inline-block; | ||
16 | + overflow:hidden; | ||
17 | + } | ||
11 | .user-name { | 18 | .user-name { |
12 | text-decoration: underline; | 19 | text-decoration: underline; |
13 | margin-left: .3em; | 20 | margin-left: .3em; |
14 | margin-right: 1em; | 21 | margin-right: 1em; |
22 | + max-width: 200rem / $pxConvertRem; | ||
23 | + text-overflow:ellipsis; | ||
24 | + white-space:nowrap; | ||
15 | } | 25 | } |
16 | 26 | ||
17 | .back-to-top { | 27 | .back-to-top { |
-
Please register or login to post a comment