Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a css pseudo selector for overflow?

I'm trying to alter the style of something based on wether or not its parent div is being overflown.

.pDiv { display: block; width: 300px; height: 100px; border: 1px solid rgb(0,0,0); } .cDiv { display: block; padding 4px; border-bottom: 1px solid rgb(0,0,0); .pDiv:overflow .cDiv { border-bottom: none; }  <div class="pDiv"><div class="cDiv">child 1</div><div class="cDiv">child 2</div><div class="cDiv">child 3</div><div class="cDiv">child 4</div><div class="cDiv">child 5</div></div> 

is it possible to do something like this? I would use the last-child pseudo-selector, but the number of children can vary, so I want it to remove the border-bottom of the last-child ONLY IF the parent div is being overflown. I want a pure CSS solution too please, no JS!

like image 203
CJT3 Avatar asked Nov 03 '12 20:11

CJT3


People also ask

What are CSS pseudo selectors?

CSS pseudo-classes are used to add styles to selectors, but only when those selectors meet certain conditions. A pseudo class is expressed by adding a colon (:) after a selector in CSS, followed by a pseudo-class such as "hover", "focus", or "active", like this: a:hover { /* your style here */ }

Is hover a pseudo selector?

The :hover CSS pseudo-class matches when the user interacts with an element with a pointing device, but does not necessarily activate it. It is generally triggered when the user hovers over an element with the cursor (mouse pointer).


1 Answers

CSS cannot select based on used or computed styles of any kind, so you're out of luck.

like image 122
BoltClock Avatar answered Oct 04 '22 14:10

BoltClock