【问题标题】:How to properly attach image into background with the bootstrap template that has been attached如何使用已附加的引导模板正确地将图像附加到背景中
【发布时间】:2021-01-19 05:15:06
【问题描述】:

通过我创建的这个帮助台应用程序,我尝试使用MacbookBackbround.jpg 作为网站的背景图片,以消除空白。我尝试了以下代码无济于事:

<div>
    <style>
        .main-content {
            background-image: 
            url('../../../../wwwroot/images/MacbookBackground.jpg');
        }
    </style>
</div>

我也试过修改theme.css代码,也试过修改.container也无济于事。

https://github.com/zhadjah9559/HelpDeskTicket/tree/3.LoginAndDB

【问题讨论】:

    标签: html css asp.net visual-studio background-image


    【解决方案1】:

    虽然有点不清楚您到底遇到了什么问题,但我可以告诉您,要拥有背景图像,您需要做的不仅仅是添加 background-image 属性。在您的 CSS 中,您向 HTML 元素添加一个 background-image 属性,其中包含指向您的图像文件的链接。如果您希望图像填满整个浏览器窗口并居中,则必须添加 height、background-position、background-repeat 和 background-size 属性。

    CSS

       html {
            background-image: url("some_img.jpg");
            height: 100%;
            background-position: center;
            background-repeat: no-repeat;
            background-size: cover;
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-20
      • 2017-05-15
      • 2015-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-16
      • 1970-01-01
      相关资源
      最近更新 更多