我正在做我的角度網站的英雄形象,圖像沒有顯示出來。我不知道爲什麼爲什麼我的圖像沒有顯示角2/4 css?
我的HTML
<div class="hero-image">
<div class="hero-text">
<h1 style="font-size:50px">I am John Doe</h1>
<p>And I'm a Photographer</p>
<button>Hire me</button>
</div>
</div>
我的CSS
.hero-image {
background-image: url("https://newsi.creativecow.com/i/879292/2.jpeg");
height: 50%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
}
.hero-text {
text-align: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: black;
}
哪裏有模板和CSS正在申報?樣式是內嵌爲'樣式「還是在'styleUrls'下引用?用這些參考顯示組件。 –
它是在styleurls下。 –
請使用然後顯示代碼。如果我把它放到我自己的組件中,它就可以工作。 –