微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 CSS 指定背景图像的大小

使用 CSS 指定背景图像的大小

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

<html> <head> <style> #demo { border: 5px dashed green; padding: 10px; background-image: url("https://www.tutorialspoint.com/css/images/css-mini-logo.jpg"); background-size: 200px 100px; } </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 @R_117_4045@ion we collect from you or what @R_117_4045@ion 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>

以上就是使用 CSS 指定背景图像的大小的详细内容,更多请关注编程之家其它相关文章

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。