css - the "pseudo element :after" part of an element is overriding overflow-x:hidden -
i have built sample 2 arrows. arrows built standard boxes - 1 h2 1 p
<header> <h2 class="maintitle">test</h2> <p class="subtitle">test test</p> </header> each box has 2 pseudo elements :before , :after. 1 creates rectangle other extends box towards page border borderless arrow. used css looks that.
html, body { overflow-x:hidden; } .wrap { width: 50em; margin: 0 auto; } section { margin-top:6em; width:100%; background-color: green; height:30em; } .maintitle, .subtitle { height: 3.5rem; line-height: 3.5rem; position:relative; } .maintitle { background-color: orange; padding-left:1rem; top: -1.77rem; text-align: left; &:before { content: ""; position:absolute; top:0; bottom:0; width: 999em; right:100%; background-color: orange; } &:after { content: ""; position:absolute; top:0; bottom:0; width:999em; left:100%; } } .subtitle { text-align: left; left:0; top:-1.77rem; padding-left: 3rem; background-color: grey; &:before { content: ""; position:absolute; top:0; bottom:0; width: 999em; right:100%; } &:after { content: ""; position:absolute; top:0; bottom:0; width: 999em; left:100%; background-color: grey; } } @media(min-width: 800px) { .maintitle { text-align: right; padding-right:1rem; &:after { right:-1.75rem; width:0; height:0; background:transparent; border-top: 1.8rem solid transparent; border-left: 1.8rem solid orange; border-bottom: 1.8rem solid transparent; } } .subtitle { top: 0; left:1.75rem; padding-left: 1rem; &:before { left:-1.75rem; width:0; height:0; background:transparent; border-top: 1.77rem solid transparent; border-right: 1.77rem solid grey; border-bottom: 1.77rem solid transparent; } } } a pen showing output here
problem pseudo element of grey arrow on right ignoring overflow-x:hidden statement in e.g. safari (in chrome works). if click mouse , drag right that:

if remove pseudo element on right , enlarge width of grey box extensively respects overflow-x:hidden shown in following pen. there way work .subtitle:after version too?
Comments
Post a Comment