ホームページ  >  記事  >  ウェブフロントエンド  >  要素の内容が、それに割り当てられたスペースより大きい可能性がある場合はどうすればよいでしょうか?

要素の内容が、それに割り当てられたスペースより大きい可能性がある場合はどうすればよいでしょうか?

WBOY
WBOY転載
2023-08-23 22:05:02571ブラウズ

要素の内容が、それに割り当てられたスペースより大きい可能性がある場合はどうすればよいでしょうか?

CSS オーバーフロープロパティを使用して、割り当てられたスペースを超えるコンテンツの問題を解決します。この問題を解決するには、次のコードを実行してみてください。 -

Example

<html>
   <head>
   </head>
   <style>
      .scroll{
         display:block;
         border: 2px solid green;
         padding:10px;
         margin-top:10px;
         width:300px;
         height:50px;
         overflow:scroll;
      }
      .auto{
         display:block;
         border: 2px solid green;
         padding:10px;
         margin-top:10px;
         width:300px;
         height:50px;
         overflow:auto;
      }
      </style>
      <body>
         <p>Example of scroll value:</p>
         <div class = "scroll">
            This is Demo Content. This is Demo Content. This is Demo Content.
            This is Demo Content. This is Demo Content. This is Demo Content.
            This is Demo Content. This is Demo Content. This is Demo Content.
            This is Demo Content. This is Demo Content. This is Demo Content.
         </div>
      <br />
   </body>
</html>

以上が要素の内容が、それに割り当てられたスペースより大きい可能性がある場合はどうすればよいでしょうか?の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事はtutorialspoint.comで複製されています。侵害がある場合は、admin@php.cn までご連絡ください。