我正在尝试将我的横幅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