【发布时间】:2018-06-14 17:27:02
【问题描述】:
我有一个问题,我想在图片旁边放一个文字,如图所示。但它不起作用。我刚刚开始 CSS 和 HTML 之旅,所以如果错误是可耻的,请不要责怪。
我没有忘记 float: left 和 clear: both 行,所以我猜这可能意味着宽度或高度太小而无法容纳文本。
我将在此处粘贴一个堆栈 sn-p。带有图片的压缩包也将包含在内,以防您想了解它是如何工作的。
body {
background-color: #444444;
font-family: 'Didact Gothic', sans-serif;
font-family: 'Lato', sans-serif;
font-size: 18px;
color: white;
}
#container {
margin-left: auto;
margin-right: auto;
width: 1000px;
}
#logo {
text-align: center;
padding: 15px;
background-color: #303030;
color: white;
font-size: 30px;
font-weight: 900;
margin-bottom: 30px;
}
#navbar {
background-color: black;
margin-top: 20px;
padding: 10px;
}
.click {
float: left;
margin-left: 20px;
}
.click:hover {
cursor: pointer;
background-color: green;
}
#quote {
height: 230px;
width: 980px;
padding: 10px;
background-color: red;
margin-top: 20px;
margin-bottom: 25px;
}
#quoteL {
float: left;
width: 200px;
height: 250px;
}
#quoteR {
float: left;
width: 800px;
font-size: 16px;
text-align: justify;
}
.bigtitle {
font-size: 32px;
font-weight: 900;
letter-spacing: 2px;
}
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>Angielski - Nauka angielskiego dla zainteresowanych</title>
<meta name="keywords" content="angielski, English, english, nauka angielskiego, angielskiego, nauka, online, nauka angielskiego online,
efektywna nauka, prosta gramatyka, gramatyka, słownictwo, tłumaczenie,
pomoc, jak" />
<meta name="description" content="Ta strona pomoże ci nauczyć się angielskiego w wolnym czasie bez problemu i z przyjemnością!" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<link rel="stylesheet" href="style.css" type="text/css" />
<link href="https://fonts.googleapis.com/css?family=Didact+Gothic|Lato:400,400i,700,900&subset=latin-ext" rel="stylesheet"> </head>
<body>
<div id="container">
<div id="logo">English 4 Everyone :D</div>
<div id="navbar">
<div class="click">TO BE</div>
<div class="click">TO HAVE/TO HAVE GOT</div>
<div class="click">PRESENT SIMPLE</div>
<div style="clear:both;"></div>
</div>
<div id="quote">
<div id="quoteL">
<img src="swan.jpg" />
</div>
<div id="quoteR">
<span class="bigtitle">Quote to success:</span> "Our job in grammar teaching is not to describe the language, as a grammarian does.It is to build a bridge from A (what the student knows) to B (what we want him/her to know next). If the bridge
is too long it will collapse." ~Michael Swan source: https://mikeswan.net/some-things-i-believe/
</div>
<div style="clear: both;"></div>
</div>
</div>
</body>
</html>
图片:
Google Drive 上的 zip 文件中的 HTML、CSS 和 jpg 文件。
【问题讨论】: