Skip to content

Commit 6132128

Browse files
committed
pref: 优化头部标题栏及头像
1 parent 0fe1d59 commit 6132128

File tree

11 files changed

+69
-53
lines changed

11 files changed

+69
-53
lines changed

src/css/common/outline/header/brand.css

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
.site-branding {
2-
float: left;
32
position: relative;
4-
line-height: var(--header-height);
53
animation: sitetop 1s;
64

75
& .site-title {
6+
display: flex;
87
margin: 0;
98

109
& a {
@@ -17,37 +16,33 @@
1716
}
1817

1918
& img {
19+
height: 2.5rem;
20+
width: 2.5rem;
21+
object-fit: cover;
22+
2023
&:hover {
2124
opacity: 1;
2225
}
2326
}
2427

2528
& a,
2629
& img {
27-
height: 2.5rem;
28-
width: 2.5rem;
29-
margin-top: 1rem;
30-
opacity: 0.75;
31-
object-fit: cover;
30+
display: inline-block;
3231
transition: color 0.2s ease-out, border 0.2s ease-out, opacity 0.2s ease-out;
3332
}
3433
}
3534

3635
@mixin screens-md {
37-
float: right;
38-
height: 2.5rem;
39-
line-height: 2.5rem;
40-
4136
& .site-title {
4237
font-size: 1.25rem;
43-
margin-right: 10px;
4438

4539
& img {
4640
height: 2rem;
4741
width: 2rem;
4842
border-radius: 100%;
4943
margin: 0;
5044
vertical-align: middle;
45+
margin-right: 0.625rem;
5146
}
5247
}
5348
}

src/css/common/outline/header/layout.css

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,29 @@
2828
}
2929

3030
& .header-inner {
31+
display: flex;
32+
align-items: center;
33+
justify-content: center;
3134
height: var(--header-height);
3235
width: 100%;
33-
display: block;
3436
margin: 0 auto;
3537
position: fixed;
3638
padding: 0 1.25rem;
3739
box-sizing: border-box;
3840
top: 0;
3941
transition: top 0.3s ease-in-out;
42+
43+
& .header-after,
44+
& .header-content,
45+
& .header-before {
46+
display: flex;
47+
align-items: center;
48+
justify-content: center;
49+
}
50+
51+
& .header-content {
52+
flex: 1;
53+
}
4054
}
4155

4256
@mixin screens-md {
@@ -48,6 +62,15 @@
4862

4963
& .header-inner {
5064
padding: 0;
65+
66+
& .header-before {
67+
flex: 1;
68+
justify-content: space-between;
69+
}
70+
71+
& .header-content {
72+
display: none;
73+
}
5174
}
5275
}
5376
}

src/css/common/outline/header/menu.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22
position: absolute;
33
text-align: center;
44
pointer-events: none;
5-
width: 100%;
6-
height: 100%;
75

86
& .lower {
97
display: inline-block;
10-
margin: 1rem 0 0 10px;
118
font-size: 1rem;
129
position: relative;
1310
pointer-events: auto;

src/css/common/outline/header/nav-toggle.css

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
@mixin screens-md {
55
transition-duration: 0.5s;
66
height: 2.5rem;
7-
position: absolute;
8-
top: 0;
9-
z-index: 10;
107
display: block;
11-
background: 0 0;
12-
8+
z-index: 10;
9+
1310
&.open {
1411
display: none;
1512
}

src/css/common/outline/header/search.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
.searchbox {
2-
float: right;
3-
height: 4.75rem;
4-
line-height: 4.75rem;
5-
margin-left: 1.25rem;
62
animation: fadeInRight 1s;
73

84
& .iconsearch {

src/css/common/outline/header/user.css

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
.header-user-avatar {
22
position: relative;
3-
float: right;
4-
margin-left: 1.25rem;
5-
margin-top: 1.375rem;
63
animation: fadeInRight 1s;
4+
margin-left: 1.25rem;
75

86
& img {
97
border-radius: 100%;
@@ -24,9 +22,8 @@
2422
.header-user-menu {
2523
position: absolute;
2624
right: -11px;
27-
top: 44px;
25+
top: 2.875rem;
2826
display: none;
29-
overflow: hidden;
3027
animation: header-user-menu 0.4s;
3128
box-shadow: 0 1px 40px -8px rgba(0, 0, 0, 0.5);
3229
border-radius: 5px;
@@ -47,13 +44,12 @@
4744
white-space: nowrap;
4845
}
4946
}
50-
47+
5148
&::before {
5249
content: "";
53-
position: fixed;
54-
top: 46px;
55-
right: 25px;
56-
margin-left: -10px;
50+
position: absolute;
51+
top: -20px;
52+
right: 18px;
5753
border-width: 10px;
5854
border-style: solid;
5955
border-color: transparent transparent var(--widget-background-color);

src/css/variables/layout.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@
108108
--theme-item-background-color: #31363b;
109109
--mobile-menu-text-color: #eee;
110110
--entry-content-heading-color: #ccc;
111-
--entry-content-text-color: #999;
112-
--entry-content-list-color: #999;
113-
--entry-content-table-color: #999;
111+
--entry-content-text-color: #ffffffcc;
112+
--entry-content-list-color: #ffffffcc;
113+
--entry-content-table-color: #ffffffcc;
114114
--card-container-box-shadow: 0 1px 35px -8px rgba(0, 0, 0, 0.8);
115115
--card-container-title-color: #ccc;
116116
--photo-group-change-color: #222;

templates/assets/dist/css/main.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
-6.95 KB
Binary file not shown.

templates/module/header/index.html

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
<th:block th:fragment="header">
2-
<th:block th:replace="~{module/header/nav-toggle}"></th:block>
3-
<th:block th:replace="~{module/header/brand}"></th:block>
4-
<th:block th:replace="~{module/header/user}"></th:block>
5-
<th:block th:replace="~{module/header/search}"></th:block>
6-
<div class="lower-container">
7-
<div class="lower">
8-
<th:block th:replace="~{module/header/menu}"></th:block>
2+
<div class="header-before">
3+
<th:block th:replace="~{module/header/nav-toggle}"></th:block>
4+
<th:block th:replace="~{module/header/brand}"></th:block>
5+
</div>
6+
<div class="header-content">
7+
<div class="lower-container">
8+
<div class="lower">
9+
<th:block th:replace="~{module/header/menu}"></th:block>
10+
</div>
911
</div>
1012
</div>
11-
</th:block>
13+
<div class="header-after">
14+
<th:block th:replace="~{module/header/search}"></th:block>
15+
<th:block th:replace="~{module/header/user}"></th:block>
16+
</div>
17+
</th:block>

0 commit comments

Comments
 (0)