CSS - overflow-inline 属性



CSS overflow-inline 属性控制内容溢出元素内联边缘时的显示方式。

overflow-inline 属性仅在 Firefox 浏览器中受支持。因此,所有示例仅在 Firefox 浏览器中有效。

可能的值

  • visible − 溢出填充盒的内容显示在其内联起始和结束边缘之外。

  • hidden − 内容在填充盒的内联起始和结束边缘处被裁剪。

  • clip − 溢出内容在溢出剪辑的边缘处被裁剪。

  • scroll − 当元素的内容超出其边界时,将添加滚动条。

  • auto − 当内容溢出容器时,将自动显示滚动条。

应用于

所有 HTML 元素。

DOM 语法

overflow-inline: visible|hidden|clip|scroll|auto;

CSS overflow-inline - 使用 visible 和 hidden 值

可以将 overflow-inline 属性设置为 visible 以允许内容溢出填充盒的边缘,或设置为 hidden 以防止其溢出。

<html>
<head>
<style>
   .container {
      display:flex;
   }
   div.overflow-inline-visible {
      background-color: #2fe262;
      border: 2px solid #000000;
      width: 170px;
      height: 160px;
      overflow-inline: visible;
      margin-right: 100px;
   }
   h4 {
      text-align: center;
      color: #D90F0F;
   }
   div.overflow-inline-hidden {
      background-color: #2fe262;
      border: 2px solid #000000;
      width: 170px;
      height: 160px;
      overflow-inline: hidden;
   }
</style>
</head>
<body>
   <div class="container">
      <div class="overflow-inline-visible">
         <h4>Tutorialspoint CSS Overflow-inline Visible</h4>
         Lorem Ipsum is simply dummy text of the printing and typesetting industry. omnis dolor repellendus. non-characteristic words, Temporibus autem quibusdam et
      </div>
      <div class="overflow-inline-hidden">
         <h4>Tutorialspoint CSS Overflow-inline Hidden</h4>
         Lorem Ipsum is simply dummy text of the printing and typesetting industry. omnis dolor repellendus. non-characteristic words, Temporibus autem quibusdam et
      </div>
   </div>
</body>
</html>

CSS overflow-inline - clip 值

如果将 overflow-inline 属性设置为 clip,则如果内容溢出填充盒的内联尺寸,则内容将被裁剪。不会添加滚动条。

<html>
<head>
<style>
   div.overflow-inline-clip {
      background-color: #2fe262;
      border: 2px solid #000000;
      width: 170px;
      height: 160px;
      overflow-inline: clip;
   }
   h4 {
      text-align: center;
      color: #D90F0F;
   }
</style>
</head>
<body>
   <div class="overflow-inline-clip">
      <h4>Tutorialspoint CSS Overflow-inline Clip</h4>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. omnis dolor repellendus. non-characteristic words, Temporibus autem quibusdam et
   </div>
</body>
</html>

CSS overflow-inline - 使用 scroll 和 auto 值

以下示例演示如何将 overflow-inline 属性设置为 scroll 以添加滚动条,或设置为 auto 以仅在必要时添加滚动条:

<html>
<head>
<style>
   .container {
      display:flex;
   }
   div.overflow-inline-scroll {
      background-color: #2fe262;
      border: 2px solid #000000;
      width: 170px;
      height: 160px;
      overflow-inline: scroll;
      margin-right: 100px;
   }
   h4 {
      text-align: center;
      color: #D90F0F;
   }
   div.overflow-inline-auto {
      background-color: #2fe262;
      border: 2px solid #000000;
      width: 170px;
      height: 160px;
      overflow-inline: auto;
   }
</style>
</head>
<body>
   <div class="container">
      <div class="overflow-inline-scroll">
         <h4>Tutorialspoint CSS Overflow-inline Scroll</h4>
         Lorem Ipsum is simply dummy text of the printing and typesetting industry. omnis dolor repellendus. non-characteristic words, Temporibus autem quibusdam et
      </div>
      <div class="overflow-inline-auto">
         <h4>Tutorialspoint CSS Overflow-inline Auto</h4>
         Lorem Ipsum is simply dummy text of the printing and typesetting industry. omnis dolor repellendus. non-characteristic words, Temporibus autem quibusdam et
      </div>
   </div>
</body>
</html>
广告