CSS 内容框值

css 内容框值

使用 CSSbackground-origin 属性设置内容框值。通过 content-box 值,背景图像从内容的左上角开始。

您可以尝试运行以下代码来实现 content-box 值:

示例

现场演示

                  #value1 {            border: 3px solid blue;            padding: 30px;            background: url(https://www.tutorialspoint.com/assets/videotutorials/courses/html_online_training/380_course_216_image.jpg);            background-repeat: no-repeat;            background-origin: padding-box;         }         #value2 {            border: 3px solid orange;            padding: 30px;            background: url(https://www.tutorialspoint.com/assets/videotutorials/courses/html_online_training/380_course_216_image.jpg);            background-repeat: no-repeat;            background-origin: border-box;         }         #value3 {            border: 3px dashed yellow;            padding: 30px;            background: url(https://www.tutorialspoint.com/assets/videotutorials/courses/html_online_training/380_course_216_image.jpg);            background-repeat: no-repeat;            background-origin: content-box;         }                  

padding-box value

     
         

Heading 2

         

This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.         

Heading 3

         This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.     
     

border-box value

     
         

Heading 2

         

This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.         

Heading 3

         This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.     
     

content-box value

     
         

Heading 2

         

This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.         

Heading 3

         This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.     
   

登录后复制

以上就是CSS 内容框值的详细内容,更多请关注【创想鸟】其它相关文章!

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

发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2864169.html

(0)
上一篇 2025年3月10日 17:25:55
下一篇 2025年3月7日 23:32:33

AD推荐 黄金广告位招租... 更多推荐

相关推荐

发表回复

登录后才能评论