I'm wondering how to draw a diagonal line between opposite corners of the browser window? Or it's more simple to make a diagonal line in photoshop and then put it as a background, but the problem if the diagonal line will look perfect in every screen size and browser...
What about something like this with a CSS gradient? You could tighten up the black so that it's very thin and there isn't much of a fade between the two yellow sections in the example below.
background-image: -webkit-gradient( linear, left bottom, right top, color-stop(0.07, #FFFF00), color-stop(0.5, #000000), color-stop(1, #FFFF00) ); background-image: -moz-linear-gradient( left bottom, #FFFF00 7%, #000000 50%, #FFFF00 100% );
what about a css transform:rotate? with an old-school tag? man, If Nicolas Gallagher can do a whole set of icons only with css, this has to be possible with Css!
I have the same problem and haven't really come up with any good solution. The best I could do without javascript was this http://jsfiddle.net/AWGHu/ and it really doesn't look good and it's not very flexible. It kind of looks good on a retina display in some sizes.
If you're ok with a css3 requirement, you can create an oversized image with a diagonal line from one corner to the other, and then apply as a fixed background on an element with background size: 100% 100%. One quibble is the line thickness will change depending on the pixel size of the viewport, but during a single session that won't be noticeable.
Or it's more simple to make a diagonal line in photoshop and then put it as a background, but the problem if the diagonal line will look perfect in every screen size and browser...
@dynamyc - http://jsfiddle.net/e9eUU/ and http://jsfiddle.net/x3sme/
You can also use an image for fallback if you'd like.
I spoke about this on Twitter and according to Tab Atkins & Lea Verou it isn't currently possible with CSS gradients.
HTMLCSSjQuery
tag? man, If Nicolas Gallagher can do a whole set of icons only with css, this has to be possible with Css!
@seb_z_lite - It's not that simple. Trust me, if anyone would know the answer, it would be those two (Lea Verou & Tab Atkins).
I think I'll go for an image instead...
Stumbled upon this when I googled the same issue:)
A technique i'm just playing with is using SVG as background image.:
background-image: url('img/bg.svg'); -o-background-size: 100% 100%; -webkit-background-size: 100% 100%;
Here's my attempt: http://zhereicome.com/experiments/statics/line/
It only works for chrome for now, because I was too lazy to add all the prefixes in the js and css.
the script:
If you're ok with a css3 requirement, you can create an oversized image with a diagonal line from one corner to the other, and then apply as a fixed background on an element with background size: 100% 100%. One quibble is the line thickness will change depending on the pixel size of the viewport, but during a single session that won't be noticeable.
You can use a diagonal (
to bottom right) gradient that is very thin..see http://jsfiddle.net/gaby/pD6Wd/