2023使用 CSS 指定背景图像的位置

 所属分类:web前端开发

 浏览:53次-  评论: 0次-  更新时间:2023-10-08
描述:更多教程资料进入php教程获得。 CSS background-origin 属性用于指定背景图像的位置。您可以尝试运行以下代码来实现background-imag...
更多教程资料进入php教程获得。

使用 CSS 指定背景图像的位置

CSS background-origin 属性用于指定背景图像的位置。您可以尝试运行以下代码来实现background-image属性 -

示例

现场演示

<html>

   <head>
      <style>
         #demo {
            border: 5px dashed red;
            padding: 10px;
            background-image: url("https://img.zzsucai.com/202310/08/jgP4T671493041621.jpg");
            background-origin: content-box;
         }
      </style>
   </head>

   <body>
      <div id="demo">
         <h1>www.tutorialspoint.com</h1>
         <p>The website www.tutorialspoint.com is owned and maintained by Tutorials Point India Private Limited, henceforth termed as “we”, “our”, “us”, or the “company”.
            All the visitors, users, learners, contributors, teachers, and instructors are named as "users"; and the website tutorialspoint.com is termed as "website" everywhere in this document.
            We are committed to protecting your privacy online. This privacy policy explains what information we collect from you or what information you share with us when you visit the website.
            We review our policy from time to time, so you are advised to check the latest version.</p>
      </div>
   </body>

</html>
 标签:
积分说明:注册即送10金币,每日签到可获得更多金币,成为VIP会员可免金币下载! 充值积分充值会员更多说明»

讨论这个素材(0)回答他人问题或分享使用心得奖励金币

〒_〒 居然一个评论都没有……

表情  文明上网,理性发言!