>  기사  >  웹 프론트엔드  >  CSS를 사용하여 배경 이미지의 크기 지정

CSS를 사용하여 배경 이미지의 크기 지정

王林
王林앞으로
2023-09-03 20:53:02728검색

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

CSS background-size 속성은 배경 이미지의 크기를 지정하는 데 사용됩니다. 다음 코드를 실행하여 배경 이미지를 얻을 수 있습니다 -

Example

Live Demo

<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 &ldquo;we&rdquo;, &ldquo;our&rdquo;, &ldquo;us&rdquo;, or the &ldquo;company&rdquo;. 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>

위 내용은 CSS를 사용하여 배경 이미지의 크기 지정의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
이 기사는 tutorialspoint.com에서 복제됩니다. 침해가 있는 경우 admin@php.cn으로 문의하시기 바랍니다. 삭제