LoginSignup
0
0

Chrome拡張のサイドバーでページ幅を縮める方法

Posted at

概要

以下のようにページ本体が右側のサイドバーによって押し縮められているような実装をしたい。

image.png

実装方法

実装方法はページのheadタグに以下を追加するだけです。

<style id="chrome-extension-style-right-space">
      html {
        width: calc(100% - 350px) !important;
      }
</style>

追加したあとのhtmlの構成はこんな感じ

<!DOCTYPE html>
<html>
    <head>
        
        ...
        
        <style id="chrome-extension-style-right-space">
              html {
                width: calc(100% - 350px) !important;
              }
        </style>
    </head>
    <body>
        
        ...
        
        <!-- Chrome拡張のサイドバーの要素 -->
        <div id="chrome-extension-content">
        #shadow-root(open)
            ...
        </div>
    </body>
</html>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0