You can use positioning to float child elements. Assuming that the parent element has a 100% width border and a black border, you can set the child element to 102% and set its background color to red, so that the background color can cover the left and right borders of the parent box.
Use pseudo elements to cover the border~ -----------------------2017.4.12 Supplement--------- ------------------ I added pseudo elements to the child, and it’s ok too
You can use positioning to float child elements. Assuming that the parent element has a 100% width border and a black border, you can set the child element to 102% and set its background color to red, so that the background color can cover the left and right borders of the parent box.
Can be implemented using: before and: after:
html
css
Effect
Use pseudo elements to cover the border~
-----------------------2017.4.12 Supplement--------- ------------------
I added pseudo elements to the child, and it’s ok too
The effect is the same as above. In order to make the effect more obvious, I set the width of the child element to 100px. The effect is as follows:
This is also okay~ I don’t know if I understand what you mean correctly... Above, Jiang Zi!
Dear, have you considered removing the border frame?
If you say it this way, isn’t it faster? ? ?