What Elvin is proposing is you:
1. Add the CSS he has provided.
2. Edit the HTML for your heading in the Text editor – and write it like so:
<h2 class="h2-with-bg alignwide">The h2 heading text</h2>
Point 2 will be required for each H2 you want that style applied to.
If you want to apply the style automatically to all H2’s in the single post content then you would need to do this:
1. First remove any CSS you have already applied to your H2.
2. Add this CSS:
.single-post .entry-content h2 {
padding: 10px 56px;
background-color: blue;
color: #fff;
margin-left: -56px;
margin-right: -56px;
}
@media(max-width: 768px) {
.single-post .entry-content h2 {
padding: 10px 20px;
margin-left: -20px;
margin-right: -20px;
}
}