Skip to content
This repository was archived by the owner on May 7, 2022. It is now read-only.

Commit bf49cda

Browse files
committed
移动端适配
1 parent e530df2 commit bf49cda

File tree

4 files changed

+79
-55
lines changed

4 files changed

+79
-55
lines changed

src/app.css

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
margin: 0;
44
padding: 0;
55
}
6-
body, html {
7-
font-size: 10px;
8-
}
9-
#root {
10-
min-width: 320px;
11-
max-width: 640px;
12-
margin: 0 auto;
13-
}
146
a {
157
text-decoration: none;
168
}
@@ -80,4 +72,38 @@ a {
8072
.left-leave.left-leave-active {
8173
opacity: 1;
8274
transition: all 0.4s ease-out;
75+
}
76+
77+
@media screen and (min-width: 320px) {
78+
html, body { font-size: 12px; }
79+
}
80+
@media screen and (min-width: 360px) {
81+
html, body { font-size: 13.5px; }
82+
}
83+
@media screen and (min-width: 375px) {
84+
html, body { font-size: 14px; }
85+
}
86+
@media screen and (min-width: 414px) {
87+
html, body { font-size: 15.5px; }
88+
}
89+
@media screen and (min-width: 720px) {
90+
html, body { font-size: 27px; }
91+
}
92+
@media screen and (min-width: 1024px) {
93+
html, body { font-size: 38.4px; }
94+
}
95+
@media screen and (min-width: 1080px) {
96+
html, body { font-size: 40.5px; }
97+
}
98+
@media screen and (min-width: 1366px) {
99+
html, body { font-size: 51px; }
100+
}
101+
@media screen and (min-width: 1440px) {
102+
html, body { font-size: 54px; }
103+
}
104+
@media screen and (min-width: 1600px) {
105+
html, body { font-size: 60px; }
106+
}
107+
@media screen and (min-width: 1920px) {
108+
html, body { font-size: 72px; }
83109
}

src/components/Search/hotSearch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ export class HotSearch extends React.Component {
1010
render() {
1111
const { hotText, hotClick } = this.props
1212
return (
13-
<span className="style_span"
13+
<a className="style_span"
1414
onClick={hotClick}
1515
>
1616
{hotText}
17-
</span>
17+
</a>
1818
)
1919
}
2020
}

src/containers/Home/styles/home.less

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,19 @@
22
position: relative;
33
width: 100%;
44
color: #fff;
5-
height: 40px;
6-
line-height: 40px;
5+
height: 3.333rem;
6+
line-height: 3.333rem;
77
text-align: center;
8-
font-size: 1.7rem;
8+
font-size: 1.4rem;
99

1010
.a_link {
1111
position: absolute;
1212
display: block;
1313
top: 0;
1414
color: #6c6c6c;
15-
right: 5%;
16-
width: 38px;
17-
height: 40px;
18-
z-index: 100;
19-
font-size: 0.9em;
20-
font-weight: normal;
15+
right: 1.25rem;
16+
width: 3.1667rem;
17+
height: 3.333rem;
2118

2219
.a_img {
2320
width: 100%;
@@ -32,7 +29,7 @@
3229
.style_div {
3330
width: 100%;
3431
background: #fff;
35-
padding: 5px 0;
32+
padding: 0.25rem 0;
3633
overflow: hidden;
3734
.style_ul {
3835
width: 90%;
@@ -44,8 +41,8 @@
4441
float: left;
4542
list-style: none;
4643
text-align: center;
47-
padding-bottom: 10px;
48-
padding-top: 5px;
44+
padding-bottom: 0.833rem;
45+
padding-top: 0.41667rem;
4946
.style_img {
5047
width: 35%;
5148
height: auto;
@@ -55,22 +52,22 @@
5552
}
5653
.style_span {
5754
color: #3c3c3c;
58-
font-size: 1.3rem;
55+
font-size: 1.2rem;
5956
}
6057
}
6158
}
6259
}
6360

6461
.style_p {
65-
font-size: 1.4rem;
66-
padding: 5px 20px;
62+
font-size: 1.3rem;
63+
padding: 0.41667rem 1.25rem;
6764
border-bottom: 1px solid #f9f9f9;
6865
}
6966

7067
.style_main {
7168
width: 100%;
7269
background: #fff;
73-
padding: 5px 0;
70+
padding: 0.41667rem 0;
7471
overflow: hidden;
7572
.style_div {
7673
width: 90%;
@@ -104,8 +101,8 @@
104101
.home-book-list {
105102
display: flex;
106103
flex-direction: row;
107-
border-bottom: 0.5rem solid #eee;
108-
padding: 1rem 0;
104+
border-bottom: 0.75rem solid #eee;
105+
padding: 0.833rem 0;
109106
.book-img {
110107
position: relative;
111108
width: 33.33%;
@@ -131,13 +128,14 @@
131128
flex-direction: column;
132129
.book-title {
133130
color: #3f3f3f;
134-
font-size: 1.6rem;
131+
font-size: 1.2rem;
135132
line-height: 1.8rem;
136133
}
137134
.book-author {
138135
color: #a0a0a0;
139-
font-size: 1.2rem;
136+
font-size: 1.1rem;
140137
line-height: 1.6rem;
141138
}
142139
}
143-
}
140+
}
141+

src/containers/Search/styles/search.less

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,67 +3,67 @@
33
width: 100%;
44
border-bottom: 1px solid #eee;
55
.style_main {
6-
padding-top: 10px;
7-
padding-bottom: 10px;
6+
padding-top: 0.833rem;
7+
padding-bottom: 0.833rem;
88
display: flex;
9+
align-items: center;
10+
911
.style_a {
10-
width: 15%;
11-
height: 25px;
12+
width: 4rem;
13+
height: 2.0833rem;
1214
display: inline-flex;
1315
text-decoration: none;
1416
justify-content: center;
15-
align-items: center;
1617
.style_a_img {
1718
width: auto;
18-
height: 25px;
19+
height: 2.0833rem;
1920
}
2021
}
2122
.style_div_content {
22-
width: 70%;
23+
width: 18rem;
2324
position: relative;
2425
.style_div_img {
2526
position: absolute;
26-
left: 2px;
27-
width: 25px;
27+
left: 0.1667rem;
28+
width: 2.0833rem;
2829
height: auto;
29-
top: 3px;
30+
top: 0.36rem;
3031
}
3132
.style_div_input {
32-
width: 78%;
33+
width: 14.5rem;
3334
border: 1px solid #efefef;
3435
background: #efefef;
35-
padding: 7px 10% 5px 12%;
36-
border-radius: 25px;
36+
padding: 0.5833rem 0.5rem 0.41667rem 2.3rem;
37+
border-radius: 2.0833rem;
3738
outline: none;
38-
font-size: 1.3rem;
39+
font-size: 1.2rem;
3940
}
4041
}
4142
.style_right_a {
42-
width: 15%;
43+
width: 4rem;
4344
text-align: center;
44-
margin-top: 5px;
45-
font-size: 1.4rem;
45+
font-size: 1.3rem;
4646
color: #3c3c3c;
4747
text-decoration: none;
4848
}
4949
}
5050
}
5151

5252
.style_div_p {
53-
padding: 5px 15px;
53+
padding: 0.833rem 1.25rem;
5454
.style_span {
5555
display: inline-block;
5656
background: #f4f4f4;
57-
padding: 5px 10px;
58-
margin-right: 5%;
59-
margin-bottom: 5px;
60-
font-size: 0.8em;
57+
padding: 0.41667rem 0.833rem;
58+
margin-right: 1rem;
59+
margin-bottom: 0.833rem;
60+
color: #444;
6161
}
6262
}
6363

6464
.search-hot-title {
65-
padding: 0.5rem 5%;
66-
font-size: 1.3rem;
65+
padding: 0.833rem 1.25rem 0 1.25rem;
66+
font-size: 1.2rem;
6767
i {
6868
color: #646464;
6969
}

0 commit comments

Comments
 (0)