How to background a div without the padding area

前端 未结 2 1736
-上瘾入骨i
-上瘾入骨i 2021-01-30 03:14

I have this class on CSS :

.mgmtError{ 
  width:716px; 
  float:left; 
  background-color:#FF0000; 
  padding:10px; 
  text-align:center;
} 

an

相关标签:
2条回答
  • 2021-01-30 03:34

    You can use

    background-clip: content-box;
    

    Also make sure to use background-color property, not background.

    0 讨论(0)
  • 2021-01-30 03:41

    If you are able to access the HTML try:

    .mgmtError {
      width: 716px;
      float: left;
      padding: 10px;
      text-align: center;
      background-color: blue;
    }
    
    .mgmtError div {
      background-color: #FF0000;
    }
    <div class="mgmtError">
      <div>Content</div>
    </div>

    0 讨论(0)
提交回复
热议问题