「CSS」inheritでスタイル(style)を継承するサンプル

2021年7月28日

書式
margin-right: inherit
使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<style>
.cftA {
border: dashed 4px green;
}
.cftB {
margin-right: 10px;
border: dashed 5px blue;
}
.cftC {
margin-right: inherit;
border: dashed 6px red;
}
</style>
<div class="cftA">
AA 11
<div class="cftB">
BB 22
<div class="cftC">CC 33</div>
</div>
</div>
<style> .cftA { border: dashed 4px green; } .cftB { margin-right: 10px; border: dashed 5px blue; } .cftC { margin-right: inherit; border: dashed 6px red; } </style> <div class="cftA"> AA 11 <div class="cftB"> BB 22 <div class="cftC">CC 33</div> </div> </div>
<style>
  .cftA {
    border:  dashed 4px green;
  }
  .cftB {
    margin-right: 10px;
    border:  dashed 5px blue;
  }
  .cftC {
    margin-right: inherit;
    border: dashed  6px red;
  }
</style>
<div class="cftA">
  AA 11
  <div class="cftB">
    BB 22
    <div class="cftC">CC 33</div>
  </div>
</div>

 

CSS

Posted by arkgame