-
Notifications
You must be signed in to change notification settings - Fork 19
/
CSS3边框相关属性.html
1 lines (1 loc) · 36.6 KB
/
CSS3边框相关属性.html
1
<!-- build time:Wed Mar 09 2022 10:17:54 GMT+0800 (GMT+08:00) --><!doctype html><html class="theme-next mist" lang="zh-Hans"><head><meta name="generator" content="Hexo 3.8.0"><meta name="google-site-verification" content="7Tau9WyVgxnsEY9oYedu9g0U6_8akOX3wiKbaYcrg9A"><meta name="baidu-site-verification" content="EVwLiaxdxX"><link href="/css/xps13.css" rel="stylesheet" type="text/css"><link href="/css/message.css" rel="stylesheet" type="text/css"><link href="//fonts.googleapis.com/css?family=Baloo+Bhaijaan|Inconsolata|Josefin+Sans|Montserrat" rel="stylesheet"><script type="text/javascript" src="/js/jquery-1.11.3.min.js"></script><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css"><link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css"><meta name="keywords" content="CSS3,CSS,"><link rel="alternate" href="/atom.xml" title="MrBird" type="application/atom+xml"><link rel="shortcut icon" type="image/x-icon" href="/bird.png?v=5.1.1"><meta name="description" content="CSS3标准发布之前,对边框的样式的设定是非常单调的。CSS3标准发布之后,我们可以使用图片来定制边框,可以设置元素的阴影以及选择使用哪种盒子模型等。border-imageborder-image属性可以用图片作为边框样式。border-image属性可以拆分为5个属性:12345border-image-source // 边框图片源border-image-slice // 边框图片切"><meta name="keywords" content="CSS3,CSS"><meta property="og:type" content="article"><meta property="og:title" content="CSS3边框相关属性"><meta property="og:url" content="http://mrbird.cc/CSS3边框相关属性.html"><meta property="og:site_name" content="MrBird"><meta property="og:description" content="CSS3标准发布之前,对边框的样式的设定是非常单调的。CSS3标准发布之后,我们可以使用图片来定制边框,可以设置元素的阴影以及选择使用哪种盒子模型等。border-imageborder-image属性可以用图片作为边框样式。border-image属性可以拆分为5个属性:12345border-image-source // 边框图片源border-image-slice // 边框图片切"><meta property="og:locale" content="zh-Hans"><meta property="og:image" content="http://mrbird.cc/img/ef7e418ec860a6a9a6ce9dbf8a058434.png"><meta property="og:image" content="http://mrbird.cc/img/34a58685d3967e3afe7634c8cd1fd754.gif"><meta property="og:updated_time" content="2020-01-21T03:30:03.123Z"><meta name="twitter:card" content="summary"><meta name="twitter:title" content="CSS3边框相关属性"><meta name="twitter:description" content="CSS3标准发布之前,对边框的样式的设定是非常单调的。CSS3标准发布之后,我们可以使用图片来定制边框,可以设置元素的阴影以及选择使用哪种盒子模型等。border-imageborder-image属性可以用图片作为边框样式。border-image属性可以拆分为5个属性:12345border-image-source // 边框图片源border-image-slice // 边框图片切"><meta name="twitter:image" content="http://mrbird.cc/img/ef7e418ec860a6a9a6ce9dbf8a058434.png"><script type="text/javascript" id="hexo.configurations">var NexT=window.NexT||{},CONFIG={root:"/",scheme:"Mist",sidebar:{position:"left",display:"always",offset:12,offset_float:0,b2t:!1,scrollpercent:!0},fancybox:!1,motion:!1}</script><title>CSS3边框相关属性 | MrBird</title></head><body ondragstart="return!1" class="animsition" lang="zh-Hans" style="overflow-x:hidden;padding-left:280px"><script type="text/javascript" src="/js/mo.min.js"></script><style>body{text-rendering:geometricPrecision!important;font-family:'Josefin Sans','PingFang SC'!important;-webkit-font-smoothing:antialiased!important;-webkit-text-size-adjust:100%!important;background-color:#f4f6f7}@media (min-width:768px) and (max-width:991px){body .header-innerr{width:700px!important}}.header-innerr{margin:0 auto;padding:100px 0 70px;width:880px}@media (min-width:1600px){.container .header-innerr{width:996px}}.header-innerr{position:relative}.header-innerr{padding:0}.header-innerr:after,.header-innerr:before{content:" ";display:table}.header-innerr:after{clear:both}@media (max-width:767px){.header-innerr{width:auto;padding:10px;margin-bottom:-20px}}</style><div class="container sidebar-position-left page-post-detail"><div class="headband"></div><header id="header" class="header"><div class="header-inner"><div class="site-brand-wrapper"><div class="site-meta"><link href="https://fonts.font.im/css?family=Merienda" rel="stylesheet"><div class="custom-logo-site-title"></div><h1 class="site-subtitle" itemprop="description"></h1></div><div class="site-nav-toggle"><button><span class="btn-bar"></span> <span class="btn-bar"></span> <span class="btn-bar"></span></button></div></div><nav class="site-nav"><div class="site-search"><div class="popup search-popup local-search-popup"><div class="local-search-header clearfix"><span class="search-icon"><i class="fa fa-search"></i> </span><span class="popup-btn-close"><i class="fa fa-times-circle"></i></span><div class="local-search-input-wrapper"><input autocomplete="off" placeholder="Search" spellcheck="false" type="text" id="local-search-input"></div></div><div id="local-search-result"></div></div></div></nav></div><div class="header-innerr"></div></header><main id="main" class="main"><div class="main-inner"><div class="content-wrap"><div id="content" class="content"><div id="posts" class="posts-expand"><article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"><link itemprop="mainEntityOfPage" href="http://mrbird.cc/CSS3边框相关属性.html"><span hidden itemprop="author" itemscope itemtype="http://schema.org/Person"><meta itemprop="name" content="MrBird"><meta itemprop="description" content=""><meta itemprop="image" content="/images/blogImage.jpg"></span><span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization"><meta itemprop="name" content="MrBird"></span><header class="post-header"><h2 class="post-title" itemprop="name headline">CSS3边框相关属性</h2><div class="post-meta"><span class="post-time"><span class="post-meta-item-icon"><i class="fa fa-calendar-o"></i> </span><span class="post-meta-item-text"></span> <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-07-17T09:26:30+08:00">2017-07-17 </time></span><span></span> <span class="post-meta-divider">|</span> <span class="page-pv"><i class="fa fa-laptop"></i> Visit count <span class="busuanzi-value" id="busuanzi_value_page_pv"></span></span></div></header><div class="post-body" itemprop="articleBody"><p>CSS3标准发布之前,对边框的样式的设定是非常单调的。CSS3标准发布之后,我们可以使用图片来定制边框,可以设置元素的阴影以及选择使用哪种盒子模型等。</p><h2 id="border-image"><a href="#border-image" class="headerlink" title="border-image"></a>border-image</h2><p><code>border-image</code>属性可以用图片作为边框样式。<code>border-image</code>属性可以拆分为5个属性:</p><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">border-image-source // 边框图片源</span><br><span class="line">border-image-slice // 边框图片切割尺寸</span><br><span class="line">border-image-width // 边框图片宽度</span><br><span class="line">border-image-outset // 边框图片区域超出元素边框的尺寸</span><br><span class="line">border-image-repeat // 边框图片中间部分在元素对应部分的存在方式</span><br></pre></td></tr></table></figure><p></p><a id="more"></a><h3 id="border-image-source"><a href="#border-image-source" class="headerlink" title="border-image-source"></a>border-image-source</h3><p>设置边框图片的源,用url()方式规定图片路径,相对和绝对路径都可。语法如下:</p><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">border-image-source : none | <url></span><br></pre></td></tr></table></figure><p></p><h3 id="border-image-slice"><a href="#border-image-slice" class="headerlink" title="border-image-slice"></a>border-image-slice</h3><p><code>border-image-slice</code>用来规定图片的切割位置。语法如下:</p><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">border-image-slice: [ <number> | <percentage>]{1,4}</span><br></pre></td></tr></table></figure><p></p><p>属性值可以为number,也可以是percentage。如果是percentage方式,则是相对于图片的尺寸。比如有如下一个边框图片:</p><p><img src="img/ef7e418ec860a6a9a6ce9dbf8a058434.png" alt="ef7e418ec860a6a9a6ce9dbf8a058434.png"></p><p>每一个小方块的尺寸是27px,那么此图片的长宽尺寸是(27*3)像素。使用如下代码进行切割:</p><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">border-image-slice</span><span class="selector-pseudo">:27px</span> 27<span class="selector-tag">px</span> 27<span class="selector-tag">px</span> 27<span class="selector-tag">px</span>;</span><br></pre></td></tr></table></figure><p></p><p>结果如下图所示:</p><p><img src="img/34a58685d3967e3afe7634c8cd1fd754.gif" alt="34a58685d3967e3afe7634c8cd1fd754.gif"></p><p>图片被切割后,会被划分为九个区域,这个九个区域会与元素的九个区域是一一对应的。</p><h3 id="border-image-width"><a href="#border-image-width" class="headerlink" title="border-image-width"></a>border-image-width</h3><p><code>border-image-width</code>用来规定边框图片宽度,语法如下:</p><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">border-image-width : [ <length> | <percentage> | <number> | auto ]{1,4}</span><br></pre></td></tr></table></figure><p></p><p>此属性可以省略,此时边框图片区域与元素的border宽度是一致的。此属性可以有1-4值,取值方式和border-width类似,同时也遵循上右下左方式。</p><h3 id="border-image-outset"><a href="#border-image-outset" class="headerlink" title="border-image-outset"></a>border-image-outset</h3><p><code>border-image-outset</code>此属性用来规定边框图片区域超出元素边框的尺寸,语法如下:</p><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">border-image-outset : [ <length> | <number> ]{1,4}</span><br></pre></td></tr></table></figure><p></p><h3 id="border-image-repeat"><a href="#border-image-repeat" class="headerlink" title="border-image-repeat"></a>border-image-repeat</h3><p><code>border-image-repeat</code>用来规定,切割后的边框图片中间部分(演示图片中的黄色部分)在元素对应部分的存在方式。语法如下:</p><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">border-image-repeat: [ stretch | repeat | round ]{1,2}</span><br></pre></td></tr></table></figure><p></p><p>三种值的含义如下:</p><ul><li><code>stretch</code>:图片以延展方式来填充该区域。</li><li><code>repeat</code>:图片以重复平铺方式来填充该区域。</li><li><code>round</code>:图片以重复平铺方式来填充该区域。如果没有以整数的倍数来填充该区域,图片会进行缩放以便于整数性倍数的平铺填充。</li></ul><p>一般都是采用<code>round</code>。</p><h3 id="具体实例"><a href="#具体实例" class="headerlink" title="具体实例"></a>具体实例</h3><p>示例1:</p><iframe height="300" scrolling="no" title="border-image-one" src="//codepen.io/mrbird/embed/KqYQXR/?height=300&theme-id=30192&default-tab=css&embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen style="width:100%">See the Pen <a href="https://codepen.io/mrbird/pen/KqYQXR/" target="_blank" rel="noopener">border-image-one</a> by wuyouzhuguli (<a href="https://codepen.io/mrbird" target="_blank" rel="noopener">@mrbird</a>) on <a href="https://codepen.io" target="_blank" rel="noopener">CodePen</a>.</iframe><p>以上代码中,border-image-slice设置为27,由于没有规定border-image-width,那么将以边框的尺寸为标准,又由于没有规定border-image-repeat属性,则默认采用stretch方式,也就是拉伸被切割的中间区域(也即是演示图中的黄色区域)。</p><p>示例2:</p><iframe height="300" scrolling="no" title="border-image-two" src="//codepen.io/mrbird/embed/QgPQxr/?height=300&theme-id=30192&default-tab=css&embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen style="width:100%">See the Pen <a href="https://codepen.io/mrbird/pen/QgPQxr/" target="_blank" rel="noopener">border-image-two</a> by wuyouzhuguli (<a href="https://codepen.io/mrbird" target="_blank" rel="noopener">@mrbird</a>) on <a href="https://codepen.io" target="_blank" rel="noopener">CodePen</a>.</iframe><p>边框设置为54px,边框图片将会自适应。</p><p>示例3:</p><iframe height="300" scrolling="no" title="border-image-three" src="//codepen.io/mrbird/embed/JJVpBj/?height=300&theme-id=30192&default-tab=css&embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen style="width:100%">See the Pen <a href="https://codepen.io/mrbird/pen/JJVpBj/" target="_blank" rel="noopener">border-image-three</a> by wuyouzhuguli (<a href="https://codepen.io/mrbird" target="_blank" rel="noopener">@mrbird</a>) on <a href="https://codepen.io" target="_blank" rel="noopener">CodePen</a>.</iframe><p>round方式可以自动调整切割后边框图片中间部分(演示图黄色部分)尺寸方式实现重复平铺效果,所以不会出现repeat那样的残缺现象。</p><h2 id="box-shadow"><a href="#box-shadow" class="headerlink" title="box-shadow"></a>box-shadow</h2><p><code>box-shadow</code>用来设置元素的投影效果。语法如下:</p><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">box-shadow</span><span class="selector-pseudo">:h-shadow</span> <span class="selector-tag">v-shadow</span> <span class="selector-tag">blur</span> <span class="selector-tag">spread</span> <span class="selector-tag">color</span> <span class="selector-tag">inset</span>;</span><br></pre></td></tr></table></figure><p></p><p>每个参数的具体意义:</p><ul><li><code>h-shadow</code>:必需,设置元素阴影水平偏移量,可以为负值,单位是像素。</li><li><code>v-shadow</code>:必需,设置元素阴影垂直偏移量,可以为负值,单位是像素。</li><li><code>blur</code>:可选,阴影模糊半径,只能够为正值,如果为0,表示不具有模糊效果,单位像素。</li><li><code>spread</code>:可选,阴影的扩展半径尺寸,可以为负值,单位是像素。</li><li><code>color</code>:可选,设置阴影的颜色;省略此参数,浏览器选取默认颜色,各个浏览器的默认可能不同,有的为透明。</li><li><code>inset</code>:可选,可以将外部阴影改为内部阴影。</li></ul><h3 id="具体实例-1"><a href="#具体实例-1" class="headerlink" title="具体实例"></a>具体实例</h3><p>示例1,只设置水平和垂直的偏移量:</p><iframe height="300" scrolling="no" title="box-shadow-one" src="//codepen.io/mrbird/embed/QgPQZx/?height=300&theme-id=30192&default-tab=css,result&embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen style="width:100%">See the Pen <a href="https://codepen.io/mrbird/pen/QgPQZx/" target="_blank" rel="noopener">box-shadow-one</a> by wuyouzhuguli (<a href="https://codepen.io/mrbird" target="_blank" rel="noopener">@mrbird</a>) on <a href="https://codepen.io" target="_blank" rel="noopener">CodePen</a>.</iframe><p>示例2,新增模糊半径和阴影颜色:</p><iframe height="300" scrolling="no" title="box-shadow-two" src="//codepen.io/mrbird/embed/NgmyeM/?height=300&theme-id=30192&default-tab=css,result&embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen style="width:100%">See the Pen <a href="https://codepen.io/mrbird/pen/NgmyeM/" target="_blank" rel="noopener">box-shadow-two</a> by wuyouzhuguli (<a href="https://codepen.io/mrbird" target="_blank" rel="noopener">@mrbird</a>) on <a href="https://codepen.io" target="_blank" rel="noopener">CodePen</a>.</iframe><p>示例3,设置多个阴影:</p><iframe height="300" scrolling="no" title="box-shadow-three" src="//codepen.io/mrbird/embed/WOWMPy/?height=300&theme-id=30192&default-tab=css,result&embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen style="width:100%">See the Pen <a href="https://codepen.io/mrbird/pen/WOWMPy/" target="_blank" rel="noopener">box-shadow-three</a> by wuyouzhuguli (<a href="https://codepen.io/mrbird" target="_blank" rel="noopener">@mrbird</a>) on <a href="https://codepen.io" target="_blank" rel="noopener">CodePen</a>.</iframe><h2 id="box-sizing"><a href="#box-sizing" class="headerlink" title="box-sizing"></a>box-sizing</h2><p><code>box-sizing</code>属性用于指定元素采用哪种盒子模型。语法如下:</p><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">box-sizing :content-box || border-box || inherit</span><br></pre></td></tr></table></figure><p></p><p>如果属性值是content-box,那么将采用标准盒模型;如果属性值是border-box,那么将采用怪异模式盒模型;如果属性值是inherit,那么将采用继承方式。</p><p>盒子模型目前安装W3C的标准可以分为两种:标准盒子模型和怪异盒子模型。</p><ul><li><strong>标准盒子模型</strong>,最常见的盒子模型,在这种盒子模型下,元素实际占宽为:width+padding+border+margin;实际占高为:height+padding+border+margin。</li><li><strong>怪异盒子模型</strong>,实际占宽:width+margin;实际占高:height+margin。其中width和height包含content,padding,border。</li></ul><p>标准盒子模型下元素的width和height构成了元素的内容区域,而这个区域对应着怪异盒子模型下content。</p><h3 id="具体实例-2"><a href="#具体实例-2" class="headerlink" title="具体实例"></a>具体实例</h3><iframe height="300" scrolling="no" title="box-sizing" src="//codepen.io/mrbird/embed/mwgxyB/?height=300&theme-id=30192&default-tab=css,result&embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen style="width:100%">See the Pen <a href="https://codepen.io/mrbird/pen/mwgxyB/" target="_blank" rel="noopener">box-sizing</a> by wuyouzhuguli (<a href="https://codepen.io/mrbird" target="_blank" rel="noopener">@mrbird</a>) on <a href="https://codepen.io" target="_blank" rel="noopener">CodePen</a>.</iframe><p>以上代码中,有一个box容器和两个子div,由于精确设定了左右两个子div的宽度,恰好和box容器宽度相同,且采用浮动,所以两个子div可以水平排列。</p><p>现在给浮动的两个元素添加padding属性值,观察结果:</p><iframe height="300" scrolling="no" title="box-sizing-two" src="//codepen.io/mrbird/embed/GELxpO/?height=300&theme-id=30192&default-tab=css,result&embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen style="width:100%">See the Pen <a href="https://codepen.io/mrbird/pen/GELxpO/" target="_blank" rel="noopener">box-sizing-two</a> by wuyouzhuguli (<a href="https://codepen.io/mrbird" target="_blank" rel="noopener">@mrbird</a>) on <a href="https://codepen.io" target="_blank" rel="noopener">CodePen</a>.</iframe><p>由于默认采用标准盒子模型,给元素添加了padding属性后,元素实际占宽度改变了(比如宽度为width+padding+border+margin,因为增加了padding,所以总体的值变大了),并且大于父元素的宽度,所以导致了换行。我们可以采用怪异盒子模型来解决这个问题:</p><iframe height="300" scrolling="no" title="RgOMaL" src="//codepen.io/mrbird/embed/RgOMaL/?height=300&theme-id=30192&default-tab=css,result&embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen style="width:100%">See the Pen <a href="https://codepen.io/mrbird/pen/RgOMaL/" target="_blank" rel="noopener">RgOMaL</a> by wuyouzhuguli (<a href="https://codepen.io/mrbird" target="_blank" rel="noopener">@mrbird</a>) on <a href="https://codepen.io" target="_blank" rel="noopener">CodePen</a>.</iframe><p>怪异盒子模型下,元素的width没有改变,所以实际占宽没变(width+margin)。而width在怪异盒子模型下的值为:content+padding+border,因为总体的值没变,border不变,padding变大,所以使得content变小。</p><blockquote><p>参考自:<a href="http://www.softwhy.com/" target="_blank" rel="noopener">http://www.softwhy.com/</a></p></blockquote><script>$(".post-body a").not(".thispage").addClass("ignore-href").attr("target","_blank")</script></div><div></div><div><div style="padding:10px 0;margin:20px auto;width:90%;text-align:center;color:#878787" id="reward-div"><div>请作者喝瓶肥宅水🥤</div><button id="rewardButton" style="margin-top:10px" disable="enable" onclick='var e=document.getElementById("QR");"none"===e.style.display?e.style.display="block":e.style.display="none"'><span style="height:46px;width:46px;line-height:46px;border-radius:50%;color:#fe5f55;font-weight:600;background:#ffd5be;border:none;box-shadow:0 4px 8px 0 rgba(255,213,190,.4)">¥</span></button><div id="QR" style="display:none"><div id="wechat" style="display:inline-block"><img id="wechat_qr" src="/img/wechat_pay.png" alt="MrBird WeChat Pay"></div><div id="alipay" style="display:inline-block"><img id="alipay_qr" src="/img/ali_pay.png" alt="MrBird Alipay"></div></div></div><style>#QR img{width:auto;margin:.8em 1em 0 1em}</style></div><div><ul class="post-copyright"><li class="post-copyright-author"><strong>本文作者:</strong> MrBird</li><li class="post-copyright-link"><strong>本文链接:</strong> <a href="http://mrbird.cc/CSS3边框相关属性.html" title="CSS3边框相关属性">http://mrbird.cc/CSS3边框相关属性.html</a></li><li class="post-copyright-license"><strong>版权声明: </strong>本博客所有文章除特别声明外,均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明出处!</li></ul></div><footer class="post-footer"><div class="post-tags" style="margin-bottom:1.3rem"><a href="/tags/CSS3/" rel="tag"># CSS3</a> <a href="/tags/CSS/" rel="tag"># CSS</a></div><div class="post-nav"><div class="post-nav-next post-nav-item"><a href="/BootstrapValidator指南.html" rel="next" title="BootstrapValidator指南"><i class="fa fa-chevron-left"></i> BootstrapValidator指南</a></div><span class="post-nav-divider"></span><div class="post-nav-prev post-nav-item"><a href="/CSS3背景属性.html" rel="prev" title="CSS3背景属性">CSS3背景属性 <i class="fa fa-chevron-right"></i></a></div></div></footer></article><hr><div id="container"></div><div class="post-spread"><div id="comment-div"></div><style>.valine .vlist{margin-bottom:3rem}.valine .vwrap .vcontrol .col.col-60{text-align:left}.valine .vlist .vcard .vhead,.valine .vlist .vcard section .vfooter{text-align:left}.valine .vlist .vcard section{padding-bottom:.5rem!important}.vname{color:#6db33f!important}div#comment-div{margin-bottom:-8rem}.valine .vlist .vcard .vcontent .code,.valine .vlist .vcard .vcontent code,.valine .vlist .vcard .vcontent pre{background:#fbfbfb}.valine .vlist .vcard .vcontent a{color:#6db33f}.valine .vlist .vcard .vimg{border-radius:3px}.valine .vinfo{text-align:left}.valine .vbtn{border-radius:2px;padding:.3rem 1.25rem}.valine .vbtn:active,.valine .vbtn:hover{color:#6db33f;border-color:#6db33f;background-color:#fff}.valine .vwrap .vheader .vinput:focus{border-bottom-color:#6db33f}.valine .vlist .vcard .vcontent.expand:before{background:-webkit-gradient(linear,left top,left bottom,from(hsla(0,0%,100%,0)),to(hsla(0,0%,100%,.2)));background:linear-gradient(180deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.2))}.valine .vlist .vcard .vcontent.expand:after{content:"点击展开";font-size:.4rem;text-align:right;left:-1rem;background:hsla(0,0%,100%,.2)}.valine .vlist .vcard section .vfooter .vat{color:#b3b3b3}.valine .vlist .vcard section .vfooter .vat:hover{color:#6db33f}.vcontent img{margin:0}.valine .info{display:none}</style><script type="text/javascript" src="/js/av.min.js"></script><script type="text/javascript" src="/js/Valine.min.js"></script><script type="text/javascript" src="/js/activate-power-mode.js"></script><script>POWERMODE.colorful=!0,POWERMODE.shake=!1,document.body.addEventListener("input",POWERMODE),new Valine({el:"#comment-div",notify:!1,verify:!0,appId:"SMcDFP1bN1jgb9Lo8JmtICHm-gzGzoHsz",appKey:"dH4nrUrt3V5XiJiI6Qyejnbi",placeholder:"",path:window.location.pathname,avatar:"monsterid",guest_info:["nick","mail","link"]});var chicken='<a href="#"><img src="https://image.uisdc.com/wp-content/uploads/2018/06/uisdc-chat-chicken.gif" class="checken"></a>';$("#comment-div").prepend(chicken)</script></div></div><script>var $bqinline=$("img[alt='bq-inline']");$bqinline.css({width:"2.3rem",height:"2.3rem",display:"inline","vertical-align":"text-bottom"})</script></div><div class="comments" id="comments"></div></div><aside id="sidebar" class="sidebar" onselectstart="return!1"><div class="sidebar-inner"><ul class="sidebar-nav motion-element"><li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">Contents</li><li class="sidebar-nav-overview" data-target="site-overview">Site Preview</li></ul><section class="site-overview sidebar-panel"><div class="sidebar-sticky sticky"><div itemscope itemtype="https://mrbird.cc"><div class="author__header"><div class="author__avatar"><img src="/images/blogImage.jpg" class="author__avatar" alt="MrBird" itemprop="image"></div><div class="author__content"><div class="author__name" itemprop="name">MrBird</div><p class="author__bio" itemprop="description">A simple blog, code repository, just keep blogging</p></div><div class="author__count"><a href="/archives" class="ignore-href"><span class="count">14</span> <span>Archives</span> </a><a href="/tags" class="ignore-href"><span class="count">2</span> <span>Labels</span></a></div></div><div class="author__urls-wrapper"><ul class="author__urls social-icons"><li><a href="/" itemprop="url" class="ignore-href">🏠 Home</a></li><li><a href="/archives" itemprop="url" class="ignore-href">📦 Archives</a></li><li><a href="/tags" itemprop="url" class="ignore-href">🔖 Labels</a></li><li><a href="/friends" itemprop="url" class="ignore-href">👬 Friends</a></li><li><a href="javascript:;" class="popup-trigger animsition-link">🔍 Search</a></li></ul></div></div></div></section><section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active"><div class="post-toc"><div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#border-image"><span class="nav-number">1.</span> <span class="nav-text">border-image</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#border-image-source"><span class="nav-number">1.1.</span> <span class="nav-text">border-image-source</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#border-image-slice"><span class="nav-number">1.2.</span> <span class="nav-text">border-image-slice</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#border-image-width"><span class="nav-number">1.3.</span> <span class="nav-text">border-image-width</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#border-image-outset"><span class="nav-number">1.4.</span> <span class="nav-text">border-image-outset</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#border-image-repeat"><span class="nav-number">1.5.</span> <span class="nav-text">border-image-repeat</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#具体实例"><span class="nav-number">1.6.</span> <span class="nav-text">具体实例</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#box-shadow"><span class="nav-number">2.</span> <span class="nav-text">box-shadow</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#具体实例-1"><span class="nav-number">2.1.</span> <span class="nav-text">具体实例</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#box-sizing"><span class="nav-number">3.</span> <span class="nav-text">box-sizing</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#具体实例-2"><span class="nav-number">3.1.</span> <span class="nav-text">具体实例</span></a></li></ol></li></ol></div></div></section></div><div id="asider-footer"><div id="links"><li><a href="https://love.mrbird.cc" target="_blank" itemprop="url" class="ignore-href"><i class="fa fa-fw fa-diamond" aria-hidden="true"></i></a></li><li><a href="https://cloud.mrbird.cn" target="_blank" itemprop="url" class="ignore-href"><i class="fa fa-fw fa-skyatlas" aria-hidden="true"></i></a></li><li><a href="https://gitee.com/mrbirdd" target="_blank" itemprop="sameAs" class="ignore-href"><i class="fa fa-fw fa-codepen" aria-hidden="true"></i></a></li><li><a href="https://github.com/wuyouzhuguli" target="_blank" itemprop="sameAs" class="ignore-href"><i class="fa fa-fw fa-github-alt" aria-hidden="true"></i></a></li></div><div id="author"></div><script type="text/javascript">var $smsheoschzd100dn="@ 2016 - "+(new Date).getFullYear()+" MrBird";document.getElementById("author").innerHTML=$smsheoschzd100dn</script><div><script type="text/javascript" src="/js/busuanzi.js"></script> UV <span class="busuanzi-value" id="busuanzi_value_site_uv" style="cursor:pointer" title="统计开始时间:2019年7月5日"></span> PV <span class="busuanzi-value" id="busuanzi_value_site_pv" style="cursor:pointer" title="统计开始时间:2019年7月5日"></span></div></div><script>function c__(){var o=sidebar_nav_toc.attr("class");o.indexOf("active")!=-1?footer.hide(300):footer.show(300)}var sidebar_nav_toc=$(".sidebar-nav-toc"),footer=$("#asider-footer");c__(),$(".sidebar-nav").on("click",function(){c__()})</script></aside></div></main><div class="back-to-top"><span id="scrollpercent"><span>0</span></span></div></div><script type="text/javascript">"[object Function]"!==Object.prototype.toString.call(window.Promise)&&(window.Promise=null)</script><script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script><script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script><script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script><script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script><script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script><script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script><script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script><script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script><script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script><script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script><script type="text/javascript">function proceedsearch(){$("body").append('<div class="search-popup-overlay local-search-pop-overlay"></div>').css("overflow","hidden"),$(".search-popup-overlay").click(onPopupClose),$(".popup").toggle();var t=$("#local-search-input");t.attr("autocapitalize","none"),t.attr("autocorrect","off"),t.focus()}var isfetched=!1,isXml=!0,search_path="search.xml";0===search_path.length?search_path="search.xml":search_path.endsWith("json")&&(isXml=!1);var path="/"+search_path,onPopupClose=function(t){$(".popup").hide(),$("#local-search-input").val(""),$(".search-result-list").remove(),$("#no-result").remove(),$(".local-search-pop-overlay").remove(),$("body").css("overflow","")},searchFunc=function(t,e,o){"use strict";$("body").append('<div class="search-popup-overlay local-search-pop-overlay"><div id="search-loading-icon"><i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i></div></div>').css("overflow","hidden"),$("#search-loading-icon").css("margin","20% auto 0 auto").css("text-align","center"),$.ajax({url:t,dataType:isXml?"xml":"json",async:!0,success:function(t){isfetched=!0,$(".popup").detach().appendTo(".header-inner");var n=isXml?$("entry",t).map(function(){return{title:$("title",this).text(),content:$("content",this).text(),url:$("url",this).text()}}).get():t,r=document.getElementById(e),s=document.getElementById(o),a=function(){var t=r.value.trim().toLowerCase(),e=t.split(/[\s\-]+/);e.length>1&&e.push(t);var o=[];if(t.length>0&&n.forEach(function(n){function r(e,o,n,r){for(var s=r[r.length-1],a=s.position,i=s.word,l=[],h=0;a+i.length<=n&&0!=r.length;){i===t&&h++,l.push({position:a,length:i.length});var p=a+i.length;for(r.pop();0!=r.length&&(s=r[r.length-1],a=s.position,i=s.word,p>a);)r.pop()}return c+=h,{hits:l,start:o,end:n,searchTextCount:h}}function s(t,e){var o="",n=e.start;return e.hits.forEach(function(e){o+=t.substring(n,e.position);var r=e.position+e.length;o+='<b class="search-keyword">'+t.substring(e.position,r)+"</b>",n=r}),o+=t.substring(n,e.end)}var a=!1,i=0,c=0,l=n.title.trim(),h=l.toLowerCase(),p=n.content.trim().replace(/<[^>]+>/g,""),u=p.toLowerCase(),f=decodeURIComponent(n.url),d=[],g=[];if(""!=l&&(e.forEach(function(t){function e(t,e,o){var n=t.length;if(0===n)return[];var r=0,s=[],a=[];for(o||(e=e.toLowerCase(),t=t.toLowerCase());(s=e.indexOf(t,r))>-1;)a.push({position:s,word:t}),r=s+n;return a}d=d.concat(e(t,h,!1)),g=g.concat(e(t,u,!1))}),(d.length>0||g.length>0)&&(a=!0,i=d.length+g.length)),a){[d,g].forEach(function(t){t.sort(function(t,e){return e.position!==t.position?e.position-t.position:t.word.length-e.word.length})});var v=[];0!=d.length&&v.push(r(l,0,l.length,d));for(var C=[];0!=g.length;){var $=g[g.length-1],m=$.position,x=$.word,w=m-20,y=m+80;w<0&&(w=0),y<m+x.length&&(y=m+x.length),y>p.length&&(y=p.length),C.push(r(p,w,y,g))}C.sort(function(t,e){return t.searchTextCount!==e.searchTextCount?e.searchTextCount-t.searchTextCount:t.hits.length!==e.hits.length?e.hits.length-t.hits.length:t.start-e.start});var T=parseInt("1");T>=0&&(C=C.slice(0,T));var b="";b+=0!=v.length?"<li><a href='"+f+"' class='search-result-title'>"+s(l,v[0])+"</a>":"<li><a href='"+f+"' class='search-result-title'>"+l+"</a>",C.forEach(function(t){b+="<a href='"+f+'\'><p class="search-result">'+s(p,t)+"...</p></a>"}),b+="</li>",o.push({item:b,searchTextCount:c,hitCount:i,id:o.length})}}),1===e.length&&""===e[0])s.innerHTML='<div id="no-result"><i class="fa fa-search fa-5x" /></div>';else if(0===o.length)s.innerHTML='<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>';else{o.sort(function(t,e){return t.searchTextCount!==e.searchTextCount?e.searchTextCount-t.searchTextCount:t.hitCount!==e.hitCount?e.hitCount-t.hitCount:e.id-t.id});var a='<ul class="search-result-list">';o.forEach(function(t){a+=t.item}),a+="</ul>",s.innerHTML=a}};r.addEventListener("input",a),$(".local-search-pop-overlay").remove(),$("body").css("overflow",""),proceedsearch()}})};$(".popup-trigger").click(function(t){t.stopPropagation(),isfetched===!1?searchFunc(path,"local-search-input","local-search-result"):proceedsearch()}),$(".popup-btn-close").click(onPopupClose),$(".popup").click(function(t){t.stopPropagation()}),$(document).on("keyup",function(t){var e=27===t.which&&$(".search-popup").is(":visible");e&&onPopupClose()})</script></body><script>$(function(){$("a").not(".nav-link,.cloud-tie-join-count,.ignore-href,.jstree-anchor").addClass("animsition-link")});var burst1=new mojs.Burst({left:0,top:0,radius:{5:40},children:{shape:"circle",fill:["red","cyan","orange"],fillOpacity:.8,radiusX:3.5,radiusY:3.5}});document.addEventListener("click",function(a){null==a.target.href&&"footer"!=a.target.className&&"copyright"!=a.target.className&&"author__urls social-icons"!=a.target.className&&"author__avatar"!=a.target.className&&"sidebar sidebar-active"!=a.target.className&&burst1.tune({x:a.pageX,y:a.pageY}).generate().replay()})</script><script type="text/javascript" src="/js/message.js"></script></html><!-- rebuild by neat -->