使大于浏览器窗口的图像居中,然后可将其用作鼠标经过图像



我应该首先说我对HTML/CSS之类的东西比较陌生。我有一张 2880x540 的图像,我希望将其设置为网站的登录页面。这意味着我需要让图像居中,以便多余的宽度从浏览器窗口中消失,而没有滚动条(超分辨率适用于更高分辨率的显示器)。我计划使用图像的两个区域作为其他两个具有相同比例的图像的翻转。

截至目前,我的代码非常基本:

    <!DOCTYPE html>
  <head>
  </head>
  <body>
  <img src="sitewide.png" width="2880" height="540"  alt=""/>
  </body>
</html>

任何反馈将不胜感激。

您可以将

图像设置为div的中心背景:

<!DOCTYPE html>
  <head>
    <style>
      body{
        overflow-x: hidden;
      }
      #bigImage{
        background:url('sitewide.png') no-repeat top center;
        width: 2880px;
        height: 540px;
      }
    </style>
  </head>
  <body>
    <div id="bigImage"></div>
  </body>
</html>

最新更新