Skip to content

Commit 560859f

Browse files
restyle new game button to put it on the right side of the introduction
1 parent 4ad15d4 commit 560859f

File tree

4 files changed

+86
-42
lines changed

4 files changed

+86
-42
lines changed

index.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ <h1 class="title">2048</h1>
2222
<div class="best-container">0</div>
2323
</div>
2424
</div>
25-
<p class="game-intro">Join the numbers and get the <strong>2048 tile!</strong></p>
26-
<a class="restart-button">New Game</a>
25+
26+
<div class="above-game">
27+
<p class="game-intro">Join the numbers and get the <strong>2048 tile!</strong></p>
28+
<a class="restart-button">New Game</a>
29+
</div>
30+
2731
<div class="game-container">
2832
<div class="game-message">
2933
<p></p>

style/helpers.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,12 @@
7070
@content;
7171
}
7272
}
73+
74+
// Clearfix
75+
@mixin clearfix {
76+
&:after {
77+
content: "";
78+
display: block;
79+
clear: both;
80+
}
81+
}

style/main.css

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ h1.title {
3030
100% {
3131
top: -50px;
3232
opacity: 0; } }
33-
3433
@-moz-keyframes move-up {
3534
0% {
3635
top: 25px;
@@ -39,7 +38,6 @@ h1.title {
3938
100% {
4039
top: -50px;
4140
opacity: 0; } }
42-
4341
@keyframes move-up {
4442
0% {
4543
top: 25px;
@@ -48,7 +46,6 @@ h1.title {
4846
100% {
4947
top: -50px;
5048
opacity: 0; } }
51-
5249
.scores-container {
5350
float: right;
5451
text-align: right; }
@@ -128,36 +125,20 @@ hr {
128125

129126
100% {
130127
opacity: 1; } }
131-
132128
@-moz-keyframes fade-in {
133129
0% {
134130
opacity: 0; }
135131

136132
100% {
137133
opacity: 1; } }
138-
139134
@keyframes fade-in {
140135
0% {
141136
opacity: 0; }
142137

143138
100% {
144139
opacity: 1; } }
145-
146-
.restart-button {
147-
display: inline-block;
148-
background: #8f7a66;
149-
border-radius: 3px;
150-
padding: 0 20px;
151-
text-decoration: none;
152-
color: #f9f6f2;
153-
height: 40px;
154-
line-height: 42px;
155-
display: block;
156-
width: 100px;
157-
margin: 10px auto 10px auto;
158-
text-align: center; }
159-
160140
.game-container {
141+
margin-top: 40px;
161142
position: relative;
162143
padding: 15px;
163144
cursor: default;
@@ -406,7 +387,6 @@ hr {
406387
-webkit-transform: scale(1);
407388
-moz-transform: scale(1);
408389
transform: scale(1); } }
409-
410390
@-moz-keyframes appear {
411391
0% {
412392
opacity: 0;
@@ -419,7 +399,6 @@ hr {
419399
-webkit-transform: scale(1);
420400
-moz-transform: scale(1);
421401
transform: scale(1); } }
422-
423402
@keyframes appear {
424403
0% {
425404
opacity: 0;
@@ -432,7 +411,6 @@ hr {
432411
-webkit-transform: scale(1);
433412
-moz-transform: scale(1);
434413
transform: scale(1); } }
435-
436414
.tile-new .tile-inner {
437415
-webkit-animation: appear 200ms ease 100ms;
438416
-moz-animation: appear 200ms ease 100ms;
@@ -456,7 +434,6 @@ hr {
456434
-webkit-transform: scale(1);
457435
-moz-transform: scale(1);
458436
transform: scale(1); } }
459-
460437
@-moz-keyframes pop {
461438
0% {
462439
-webkit-transform: scale(0);
@@ -472,7 +449,6 @@ hr {
472449
-webkit-transform: scale(1);
473450
-moz-transform: scale(1);
474451
transform: scale(1); } }
475-
476452
@keyframes pop {
477453
0% {
478454
-webkit-transform: scale(0);
@@ -488,7 +464,6 @@ hr {
488464
-webkit-transform: scale(1);
489465
-moz-transform: scale(1);
490466
transform: scale(1); } }
491-
492467
.tile-merged .tile-inner {
493468
z-index: 20;
494469
-webkit-animation: pop 200ms ease 100ms;
@@ -498,8 +473,27 @@ hr {
498473
-moz-animation-fill-mode: backwards;
499474
animation-fill-mode: backwards; }
500475

476+
.above-game:after {
477+
content: "";
478+
display: block;
479+
clear: both; }
480+
501481
.game-intro {
502-
margin-bottom: 0; }
482+
float: left;
483+
line-height: 42px; }
484+
485+
.restart-button {
486+
display: inline-block;
487+
background: #8f7a66;
488+
border-radius: 3px;
489+
padding: 0 20px;
490+
text-decoration: none;
491+
color: #f9f6f2;
492+
height: 40px;
493+
line-height: 42px;
494+
display: block;
495+
text-align: center;
496+
float: right; }
503497

504498
.game-explanation {
505499
margin-top: 50px; }
@@ -528,7 +522,21 @@ hr {
528522
.heading {
529523
margin-bottom: 10px; }
530524

525+
.game-intro {
526+
width: 55%;
527+
display: block;
528+
box-sizing: border-box;
529+
line-height: 1.65; }
530+
531+
.restart-button {
532+
width: 42%;
533+
padding: 0;
534+
display: block;
535+
box-sizing: border-box;
536+
margin-top: 2px; }
537+
531538
.game-container {
539+
margin-top: 40px;
532540
position: relative;
533541
padding: 10px;
534542
cursor: default;

style/main.scss

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ body {
3434
margin: 80px 0;
3535
}
3636

37-
.heading:after {
38-
content: "";
39-
display: block;
40-
clear: both;
37+
.heading {
38+
@include clearfix;
4139
}
4240

4341
h1.title {
@@ -168,17 +166,10 @@ hr {
168166
line-height: 42px;
169167
}
170168

171-
.restart-button {
172-
@include button;
173-
display: block;
174-
width: 100px;
175-
margin: 10px auto 10px auto;
176-
text-align: center;
177-
}
178-
179169
// Game field mixin used to render CSS at different width
180170
@mixin game-field {
181171
.game-container {
172+
margin-top: 40px;
182173
position: relative;
183174
padding: $grid-spacing;
184175

@@ -454,8 +445,24 @@ hr {
454445
@include animation-fill-mode(backwards);
455446
}
456447

448+
.above-game {
449+
@include clearfix;
450+
// margin-bottom: 10px;
451+
}
452+
457453
.game-intro {
458-
margin-bottom: 0;
454+
float: left;
455+
line-height: 42px;
456+
// margin-bottom: 0;
457+
}
458+
459+
.restart-button {
460+
@include button;
461+
display: block;
462+
// width: 100px;
463+
// margin: 10px auto 10px auto;
464+
text-align: center;
465+
float: right;
459466
}
460467

461468
.game-explanation {
@@ -499,6 +506,22 @@ hr {
499506
margin-bottom: 10px;
500507
}
501508

509+
// Show intro and restart button side by side
510+
.game-intro {
511+
width: 55%;
512+
display: block;
513+
box-sizing: border-box;
514+
line-height: 1.65;
515+
}
516+
517+
.restart-button {
518+
width: 42%;
519+
padding: 0;
520+
display: block;
521+
box-sizing: border-box;
522+
margin-top: 2px;
523+
}
524+
502525
// Render the game field at the right width
503526
@include game-field;
504527

0 commit comments

Comments
 (0)