How to manipulate the CSS in the following tags using jQuery?
h1:after { ... }
h1:before { ... }
Thanks! Or perhaps an alternative, maybe setting this via jQuery on each resize of the browser would be great, to ensure that this displays properly on browser resizing events.
Am using the following CSS, and because pixel values are more accurate for displaying purposes with CSS Triangles, I do not use em values. em values give undesirable results:
h1 {
font-family: "MissionGothic-Regular", "Mission Gothic Regular Regular", "mission_gothicregular";
font-size: 1em;
margin: 0 -2.1em;
background:#BF2C24;
display: inline-block;
color: #f2efe9;
position: relative;
height: 40px;
line-height: 40px;
text-transform: uppercase;
}
h1:before {
position: absolute;
content: "";
top: 0px;
left: -20px;
height: 0px;
width: 0px;
border-top: 20px solid #BF2C24;
border-left: 20px solid transparent;
border-bottom: 20px solid #BF2C24;
margin-left: 0;
}
h1:after {
position: absolute;
content: "";
top: 0px;
left: auto;
right: 20px;
height: 0px;
width: 0px;
border-top: 20px solid #BF2C24;
border-right: 20px solid transparent;
border-bottom: 20px solid #BF2C24;
margin-right: -40px;
}
So, I need to manipulate a few rules on resizing of the browser. Where it says pixels (px) mainly.
***EDIT - So, if this can't be done in jQuery with :after
and/or :before
, is there another way to do it? Maybe I need to change the CSS? Any suggestions??
Why is this question being voted to be closed?