我正在嘗試將我的橫幅img置於導航欄正下方。我想把它放在左邊的文字。 我已經能夠做到這一點,但圖像上的文字根本沒有反應。如何在瀏覽器更改大小時使文本更改大小?此外,我認爲我的CSS已遍佈全球,所以如果您有任何建議,我們將非常感謝!嘗試將響應文本對齊的主橫幅對齊左邊
下面是標記:
.topimage img {
position: relative;
width: 100%;
padding-top: 10px;
}
li {
list-style-type: none;
}
h1 {
z-index: 100;
position: absolute;
color: #272727;
font-size: 45px;
font-weight: normal;
left: 650px;
top: 250px;
font-family: Helvetica Neue, arial, serif;
}
.maintitle p {
z-index: 100;
position: absolute;
color: #272727;
font-size: 17px;
font-weight: normal;
left: 650px;
top: 390px;
font-family: Helvetica Neue, arial, serif;
}
.maintitle ul {
list-style-type: none;
}
a {
text-decoration: none;
}
.maintitle li {
z-index: 100;
position: absolute;
color: #272727;
font-size: 15px;
font-weight: bold;
left: 650px;
top: 470px;
font-family: Helvetica Neue, arial, serif;
border-style: solid;
border-width: medium;
border-color: #272727;
border-radius: 6px;
padding: 6px;
}
a:visited {
text-decoration: none;
color: #272727;
}
.maintitle a:hover {
background-color: #6db618;
border-color: #6db618;
color: white;
}
.maintitle li:hover {
background-color: #6db618;
border-color: #6db618;
color: white;
}
<div class="topimage">
<img alt="plant" src="images/main.png" />
</div>
<div class="maintitle">
<h1>Marketing Communications & <br> Digital Design</h1>
<p>Marketing enthusiast who has also ventured into the digital design world. Combining <br> strategy with creativity is essential in my books!</p>
<ul>
<li class="aboutme"><a id="aboutmelink" href="#about">My Story</a></li>
</ul>
</div>
這就是我想要實現: enter image description here
如果你只是想文本改變大小,[使用'vw'單位(https://css-tricks.com/viewport-sized-typography /) – Blazemonger
css tip:儘量不要使用元素選擇器,它們非常昂貴 - 嘗試記住css匹配從右到左的所有內容,例如,您的'.maintitle li'選擇器將匹配'li'的所有元素和然後查看哪些元素在具有主類的元素內。這意味着在一個有很多li的頁面上,它會在過濾之前抓住它們 – Pete