Posts

Showing posts with the label css3

Do CSS combinators add specificity to a CSS selector?

Image
Do CSS combinators add specificity to a CSS selector? The mdn article about CSS specificity states: Universal selector (*), combinators (+, >, ~, ' ') and negation pseudo-class (:not()) have no effect on specificity. (The selectors declared inside :not() do, however.) However my experience is that combinators do have an effect, see this example: div > p { color: red; } p { color: green; } <div> <p>First Paragraph</p> <p>Second Paragraph</p> </div> So the above quote claims, that CSS combinators have no effect on specificity. If that quote is right, how is it meant then, as my code example shows the opposite? possible duplicate of : stackoverflow.com/questions/2809024/points-in-css-specificity – Temani Afif Jul 1 at 19:11 could be except they never mention ...

text overflow on skew div containers

text overflow on skew div containers currently I use clip-path for containers that should be skew. clip-path .box { height: 150px; line-height: 150px; text-align: center; background: yellow; } #first { clip-path: polygon(0 20%, 100% 0%, 100% 80%, 0 100%); } #second { clip-path: polygon(0 0, 100% 20%, 100% 100%, 0 80%); } #spacing { height: 100px; } <div id="first" class="box"> <p> first container with a very very very long text. It's really long and won't fit here. Some text may disappear when the screen size gets smaller. </p> </div> <div id="spacing"> </div> <div id="second" class="box"> <p> second container with a longer text </p> </div> If the window gets smaller the text will not break into a new line it will just disappear. How can I make the missing part of the text appear in the next line? You can find an example of what I want to ...