亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

HTML/CSS:背景圖像始終與段落相關

HTML/CSS:背景圖像始終與段落相關

白豬掌柜的 2023-10-24 15:50:42
我正在使用 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%應用程序根。


查看完整回答
反對 回復 2023-10-24
  • 1 回答
  • 0 關注
  • 140 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號