2
I’m trying to create the following picture
And I want to draw a line between each of them
I believe it’s taking the X and Y axis, how do I do it?
2
I’m trying to create the following picture
And I want to draw a line between each of them
I believe it’s taking the X and Y axis, how do I do it?
3
I have prepared a more flexible solution for you, based on the comments and without the need for any Javascript.
HTML:
<div id="wrapper">
<div id="elements">
<div class="negate"></div>
<div class="element"></div>
<div class="element"></div>
<div class="element"></div>
<div class="element"></div>
</div>
</div>
CSS:
#elements {
width: 420px;
height: 220px;
border: 2px solid black;
}
.element {
width: 200px;
height: 100px;
margin: 5px;
float: left;
border: 2px solid black;
box-sizing: border-box;
}
.negate {
background:
linear-gradient(to top left,
rgba(255, 0, 0, 0) 0%,
rgba(255, 0, 0, 0) calc(50% - 3px),
rgba(255, 0, 0, 1) 50%,
rgba(255, 0, 0, 0) calc(50% + 3px),
rgba(255, 0, 0, 0) 100%);
width: inherit;
height: inherit;
position: absolute;
}
To play and test, I prepared this jsFiddle. For a closer look to that presented by you, see the update 1.
css3, Nice! Front-end op
Browser other questions tagged javascript jquery
You are not signed in. Login or sign up in order to post.
You can play with Canvas.
– Victor Martins
The lower left point is
(div3.pageX, div3.pageY + div3.height)
; the upper right is(div2.pageX + div2.width, div2.pageY)
.– mgibsonbr
It’s not quite what you want, but here is a CSS3 solution. Based in that reply soen
– Anthony Accioly
How about this, based on what Anthony put up, is what you want? http://jsfiddle.net/s4bNw/
– Pedro Lorentz
Might be, but would it look better with div or take a look at canvas as @dxhj commented
– Rod
The two solutions are acceptable, I believe.
– Victor Martins