【发布时间】:2018-06-07 05:06:42
【问题描述】:
请注意,我不能在这里更改 HTML,只能更改 CSS。当屏幕变小时,我希望这两个词保持在同一行(至少只要两边都有空格),但是它们目前很容易崩溃,即使两边都有很多空格。
Codepen:https://codepen.io/anon/pen/BVzRbg
html {
}
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
#link {
position: absolute;
margin-top: 5px;
left: 45%;
right: 45%;
}
#link a {
margin-top: 5px;
color: #fefefe;
background-color: rgb(75, 101, 198, 1);
/*line-height: 20px;*/
padding: 10px 9px;
text-decoration: none;
text-shadow: 0 1px 0 #3c58c7;
font-weight: 500;
}
#link a:hover {
background-color: #354eb1
}
#one {
border: 5px solid rgb(242, 168, 60, 1);
padding: 5px;
float: left;
width: 25%;
margin: 5px;
}
#two {
border: 5px solid rgb(55, 124, 33, 1);
padding: 5px;
float: right;
width: 25%;
margin: 5px;
}
#three {
border: 5px solid rgb(255, 253, 85, 1);
padding: 5px;
float: left;
width: 25%;
margin: 5px;
position: fixed;
bottom: 5px;
}
#four {
border: 5px solid rgb(0, 34, 245, 1);
padding: 5px;
float: right;
width: 25%;
margin: 5px;
position: fixed;
bottom: 5px;
right: 0px;
}
<!DOCTYPE html>
<html>
<head>
<title>Blocks</title>
<!-- Do not change this file - add your CSS styling
rules to the blocks.css file included below -->
<link type="text/css" rel="stylesheet" href="blocks.css">
</head>
<body>
<div id="one">
Turns out you have a really fun time if you
go to work every day and focus on being
silly and funny and happy! - Hannah Murray
</div>
<div id="two">
All you need in this life is ignorance and confidence,
and then success is sure. - Mark Twain
</div>
<div id="three">
Well, if crime fighters fight crime and fire fighters
fight fire, what do freedom fighters fight? They never
mention that part to us, do they? - George Carlin
</div>
<div id="four">
Great minds discuss ideas; average minds discuss events;
small minds discuss people. - Eleanor Roosevelt
</div>
<p id="link">
<a href="https://www.brainyquote.com/" target="_blank">
Brainy Quote
</a>
</p>
</body>
</html>
【问题讨论】: