Answer the question
In order to leave comments, you need to log in
Why does the content of the page not change depending on the size of the window?
Good afternoon! There is an html file and two CSS. With the first, when the page is reduced, the text crawls out of its borders, with the second it does not. I can't understand why. Explain, please.
This is a task with Codecademy, I did everything necessary and noticed such a difference.
HTML:
<!doctype html>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Oswald:400,700' rel='stylesheet' type='text/css'>
<link rel='stylesheet' href='style.css'/>
</head>
<body>
<div class="main">
<div class="container">
<h1>Move</h1>
<p>Form healthy habits to take your fitness to the next level.</p>
<a href="#">Start now</a>
</div>
</div>
<div class="supporting">
<div class="container">
<div class="col">
<h2>Move</h2>
<p>Become more active by tracking your runs, rides, and walks.</p>
</div>
<div class="col">
<h2>Sync</h2>
<p>Access your activity on your phone, tablet, or computer.</p>
</div>
<div class="col">
<h2>Compete</h2>
<p>Set personal challenges and see how you rank against your friends.</p>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="feature">
<div class="container">
<h2>Move. Rest. Recover. Move.</h2>
</div>
</div>
<div class="supporting">
<div class="container">
<h2>Go premium</h2>
<p>Receive recommendations based on your activity to level up.</p>
<a href="#" class="btn">Learn more</a>
<div class="clearfix"></div>
</div>
</div>
<div class="footer">
<div class="container">
<h2>Stop scrolling. Start moving</h2>
<a href="#" class="btn">Start now</a>
</div>
</div>
</body>
</html>
html, body {
margin: 0;
}
h1, h2, a {
font-family: 'Oswald', sans-serif;
}
p {
font-family: Helvetica, Arial, sans-serif;
}
.container {
width: 940px;
margin: 0 auto;
}
/* Main */
.main {
height: 600px;
/*background: transparent url("https://s3.amazonaws.com/codecademy-content/projects/move/bg.jpg") no-repeat scroll center center / cover;*/
background: url(https://s3.amazonaws.com/codecademy-content/projects/move/bg.jpg) no-repeat center center;
background-size: cover;
text-align: center;
}
.main h1 {
font-size: 150px;
color: white;
text-transform: uppercase;
margin: 0px;
padding-top: 100px;
}
.main p {
font-size: 18px;
color: white;
margin-bottom: 20px;
}
.main a {
color: white;
padding: 10px 25px 10px 25px;
background-color: black;
text-transform: uppercase;
text-decoration: none;
}
.main a:hover {
background-color: orange;
}
/* Supporting */
.supporting {
text-align: center;
padding: 50px 0 80px;
background-color: #1c1c1c;
}
.supporting .col {
float: left;
width: 28%;
padding: 10px;
}
.supporting h1,
.supporting h2 {
color: #ffa800;
font-size: 20px;
margin-bottom: 10px;
color: orange;
text-transform: uppercase;
}
.col h2 {
text-transform: uppercase;
color: orange;
}
.col p {
color: white;
}
.clearfix {
clear: both;
}
.supporting p {
color: #efefef;
margin-bottom: 20px;
line-height: 20px;
font-size: 12px;
}
.supporting .btn {
background-color: #eee;
color: #1c1c1c;
font-size: 18px;
padding: 8px 30px;
text-decoration: none;
display: inline-block;
text-transform: uppercase;
}
.supporting .btn:hover {
background-color: orange;
}
/* Feature */
.feature {
height: 600px;
/*background: transparent url("https://s3.amazonaws.com/codecademy-content/projects/move/feature.jpg") no-repeat scroll center center / cover;*/
background: url(https://s3.amazonaws.com/codecademy-content/projects/move/feature.jpg) no-repeat center center;
background-size: cover;
text-align: center;
}
.feature h1,
.feature h2 {
color: #fff;
font-size: 40px;
margin: 0;
padding:50px 0 0;
text-transform: uppercase;
}
.feature .container {
position: relative;
top: 200px;
}
/* Footer */
.footer {
height: 600px;
background: transparent url("https://s3.amazonaws.com/codecademy-content/projects/move/footer.jpg") no-repeat scroll center center / cover;
text-align: center;
}
.footer h1,
.footer h2 {
color: #fff;
font-size: 40px;
margin: 0 0 20px 0;
padding:50px 0 0;
text-transform: uppercase;
}
.footer p {
color: #fff;
margin: 0 0 20px 0;
font-size: 18px;
}
.footer .btn {
background-color: #1c1c1c;
color: white;
font-size: 18px;
padding: 8px 30px;
text-decoration: none;
display: inline-block;
text-transform: uppercase;
}
.footer .btn:hover {
background-color: orange;
}
.footer .container {
position: relative;
top: 150px;
}
@media (min-width:600px) {
.main h1 {
font-size: 200px;
}
.supporting .col {
width: 30%;
}
.supporting h2 {
font-size: 40px;
}
.supporting p {
font-size: 14px;
}
.feature h2 {
font-size: 60px;
}
}
@font-face {
font-family: 'Oswald';
font-style: normal;
font-weight: 400;
src: local('Oswald Regular'), local('Oswald-Regular'), url(https://fonts.gstatic.com/s/oswald/v10/pEobIV_lL25TKBpqVI_a2w.woff2) format('woff2');
}
@font-face {
font-family: 'Oswald';
font-style: normal;
font-weight: 700;
src: local('Oswald Bold'), local('Oswald-Bold'), url(https://fonts.gstatic.com/s/oswald/v10/bH7276GfdCjMjApa_dkG6VtXRa8TVwTICgirnJhmVJw.woff2) format('woff2');
}
html, body {
margin: 0;
}
h1, h2, a {
font-family: 'Oswald', sans-serif;
text-transform: uppercase;
}
p {
font-family: Helvetica, Arial, sans-serif;
}
.container {
max-width: 940px;
margin: 0 auto;
}
/* Main */
.main {
text-align: center;
background: url(bg.jpg) no-repeat center center;
background-size: cover;
height: 600px;
}
.main .container {
position: relative;
top: 100px;
}
.main h1 {
color: #fff;
margin: 0;
font-size: 150px;
}
.main p {
color: #fff;
margin: 0 0 20px 0;
font-size: 18px;
}
.main .btn {
background-color: #1c1c1c;
color: #fff;
font-size: 18px;
padding: 8px 30px;
text-decoration: none;
display: inline-block;
}
/* Supporting */
.supporting {
background-color: #1c1c1c;
text-align: center;
padding: 50px 0 80px;
}
.supporting .col {
float: left;
width: 28%;
padding: 10px;
}
.supporting h2 {
color: #ffa800;
font-size: 20px;
margin-bottom: 10px;
}
.clearfix {
clear: both;
}
.supporting p {
color: #efefef;
margin-bottom: 20px;
line-height: 20px;
font-size: 12px;
}
.supporting .btn {
background-color: #eee;
color: #1c1c1c;
font-size: 18px;
padding: 8px 30px;
text-decoration: none;
display: inline-block;
}
/* Feature */
.feature {
background: url(feature.jpg) no-repeat center center;
background-size: cover;
height: 600px;
text-align: center;
}
.feature .container {
position: relative;
top: 200px;
}
.feature h2 {
color: #fff;
font-size: 40px;
margin:0;
padding:50px 0 0;
}
/* Footer */
.footer {
background: url(footer.jpg) no-repeat center center;
background-size: cover;
height: 600px;
text-align: center;
}
.footer .container {
position: relative;
top: 200px;
}
.footer h2 {
color: #fff;
font-size: 40px;
margin: 0 0 20px 0;
padding:50px 0 0;
}
.footer p {
color: #fff;
margin: 0 0 20px 0;
font-size: 18px;
}
.footer .btn {
background-color: #1c1c1c;
color: #fff;
font-size: 18px;
padding: 8px 30px;
text-decoration: none;
display: inline-block;
}
a.btn:hover {
background:#ffa800;
color:#000;
}
@media (min-width:600px) {
.main h1 {
font-size: 200px;
}
.supporting .col {
width: 30%;
}
.supporting h2 {
font-size: 40px;
}
.supporting p {
font-size: 14px;
}
.feature h2 {
font-size: 60px;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question