Can I make part (from x1 to x2) of div border transparent?
If not what approach can you advice?
My idea [very bad] is to draw border in canvas element and place it (canvas body is trasparent) over div element.
Can I make part (from x1 to x2) of div border transparent?
If not what approach can you advice?
My idea [very bad] is to draw border in canvas element and place it (canvas body is trasparent) over div element.
Here are two possible ways to do this:
Required
HTML
will remain the same in both methods and is as follows:HTML:
Method #01:
border
css property.linear-gradient
css property.CSS:
Method #02:
border
css property.:before
and:after
pseudo elements.CSS:
Since DIVs have only 4 elements (top, bottom, left, right) you can't make part of a border transparent AFAIK.
However, you could create elements that would overlay your div and use relative positioning to build a border to your taste. For example:
You can see the result at http://jsfiddle.net/Bekqu/3/.