我正在使用 Angular 創建一個測試網站,只是為了學習一些東西。首先,我將所有內容放入 index.html 中,這就是我想出的外觀:索引.html:<!doctype html> <html><head> <meta charset="utf-8"> <title>Reiche Freunde</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"></head><body> <a href="http://google.com"> <p style="text-align: center; margin-top: 15%;"><img src="assets/Mony.gif" /></p> </a></body></html>然后我復制了這個 html 代碼并將其輸入到 app.component.html 中?;氐絠ndex.html,我改變了<body style="background-image: url('assets/geld.jpg');"> <a href="http://google.com"> <p style="text-align: center; margin-top: 15%;"><img src="assets/Mony.gif" /></p> </a></body>到<body> <app-root></app-root></body>但后來我的網站開始看起來像這樣:我哪里犯了錯誤?我的 app.component.css 是空的,因此沒有任何東西能夠改變該背景的外觀。我看不出該段落和正文本身之間有任何聯系,但背景仍然與我的美元鈔票相關。當我將其放入 app.component.css 中時:body { position: absolute;},然后我得到這個:我只是 html/css 的初學者,但所有有關背景圖像的教程對我來說沒有任何改變
1 回答

德瑪西亞99
TA貢獻1770條經驗 獲得超3個贊
看起來您有兩個身體標簽:)
其中第一個位于 (?index.html
),第二個位于app.component.html
:
<body> ??<app-root></app-root> ??</body>
您可以將 body 保留在 中app.component.html
,但應該將其從 index.html 中刪除。我想,并申請display: block; height: 100%
應用程序根。
- 1 回答
- 0 關注
- 140 瀏覽
添加回答
舉報
0/150
提交
取消