Last active
August 29, 2015 14:05
-
-
Save ChrisBAshton/80e90dcf0acf30a5b02b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.alignleft { | |
float: left; | |
} | |
.longtext { | |
@text (length < 300) { | |
overflow: hidden; | |
} | |
} | |
.longtext { | |
overflow: min-words 5; | |
} | |
/* | |
<img class="alignleft" src="some_src.png" /> <p class="longtext">This is my accompanying text.</p> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If the text is long enough, I want it to overflow under the image. But if the text is a bit short, it's silly to have it overflow under the image if, say, only one word will flow underneath. This CSS proposal tries to fix the issue.
I've proposed two different ways of achieving this - one is a new meta wrapper like a media query, and the other is a new allowed value for 'overflow'.
The first will only overflow if the text length is a minimum of 300 characters. The second implementation will only overflow if the text is long enough that at least 5 words will flow underneath.
Yes, this could be achieved in JavaScript - but once again, I feel this is presentation logic and should be encompassed in CSS.
See css-dom-position.css for another CSS proposal.