How to background a div without the padding area

HtmlCss

Html Problem Overview


I have this class on CSS :

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

and I'd like to color the background not in the padding area. I tryed with margin, but seems that it have some troubles with IE.

Any others solution?

Html Solutions


Solution 1 - Html

You can use

background-clip: content-box;

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

Solution 2 - Html

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>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionkwichzView Question on Stackoverflow
Solution 1 - HtmlYacine ZalouaniView Answer on Stackoverflow
Solution 2 - HtmlDanielBView Answer on Stackoverflow