html - How to exclude element from parent CSS -


I have a question that the HR element allows the divider to ignore the padding in which it has been placed. There is a padding in: padding: 0 20px 0 20px; , but it affects my headers and text, which I like but I want to use the HR tag as a 100% divider.

It looks like:

  * ------------ * | Header tag | | ---------- | | Some text | | Some text | * ------------ *  

But how can I do this so it works like this:

  * - ----------- * | Header tag | + ------------ + | Some text | | Some text | * ------------ *  

so that the HR element is on the actual 100% width, so except padding.

Any suggestions?

Using a negative margin, which is equal to padding.

In this HTML code:

  & lt; Div & gt; Text & lt; Hour / & gt; Text & lt; / Div & gt;  

Use this CSS:

  div {width: 200px; Padding: 10px; Limit: 1px solid black; } Hour {margin-left: -10px; Margin-right: -10 pixel; }  

Also see.


Comments