I have created a skewed div using following css
#outer-left{
-ms-transform: skew(-30deg,0deg); /* IE 9 */
-webkit-transform:skew(-30deg,0deg); /* Chrome, Safari, Opera */
transform: skew(-30deg,0deg);
background:#333333;
width:200px;
z-index:20;
border-bottom:3px solid #2E8DEF;
padding:10px 30px 10px 75px;
font-size:20px;
color:#2E8DEF;
position:relative;
left:-50px;
}
#outer-left:after{
content:"";
display:inline-block;
position:absolute;
width:20px;
height:100%;
background:#2E8DEF;
float:right;
right:0px;
top:0px;
z-index:10;
}
#inner-left{
-ms-transform: skew(30deg,0deg); /* IE 9 */
-webkit-transform: skew(30deg,0deg); /* Chrome, Safari, Opera */
transform: skew(30deg,0deg);
display:inline-block;
}
And used two divs i.e. outer div to skew border and div and inner div to cancel the skew effect for text.
But I have achieved same effect using only one div in div3
Look at fiddle: http://jsfiddle.net/5a7rhh0L/
IF I do the same as in div 3 with more text it gets distorted.
But not so in case of div2 with more text using 2 divs.
I am completely aware of what is happening here. I want to know if DIV2 can be achieved using only one div i.e. <div id="inner-div">Context<br>Hello</div> and now without using two divs i.e. inner and outer one.
I believe this is what you want:
http://jsfiddle.net/5a7rhh0L/3/
CSS:
#a {
position: relative;
width: 120px;
padding: 10px 20px;
font-size: 20px;
position: relative;
color: #2E8DEF;
background: #333333;
border-bottom: 3px solid #2E8DEF;
}
#a:after {
content: " ";
position: absolute;
display: block;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: -1;
background: #333333;
border-bottom: 3px solid #2E8DEF;
border-right: 20px solid #2E8DEF;
transform-origin: bottom left;
-ms-transform: skew(-30deg, 0deg);
-webkit-transform: skew(-30deg, 0deg);
transform: skew(-30deg, 0deg);
}
Related
I want to create a button with an x that is centred inside of a circle border. How can I centre the x vertically and horizontally inside of the circle?
I'm open to a different way of doing it than the code I have provided.
Any help is much appreciated, thank you
https://codepen.io/glittergirl/pen/xybOzL
#mdiv {
position: fixed;
right: 0;
top: 0;
margin: 20px;
border: 2px solid #000;
border-radius: 16px;
width: 34px;
height: 34px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.mdiv {
height:25px;
width:3px;
background-color: #000;
transform: rotate(45deg);
-webkit-transform: rotate(45deg); /* Safari and Chrome */
-ms-transform: rotate(45deg); /* IE 9 */
Z-index:1;
}
.md {
height:25px;
width:3px;
background-color:#000;
-webkit-transform: rotate(90deg); /* Safari and Chrome */
-ms-transform: rotate(90deg); /* IE 9 */
transform: rotate(90deg);
Z-index:2;
}
You can use centering with left&top: 50% and transform: translate(-50%, -50%)
See this codepen for an example.
https://codepen.io/anon/pen/vVEKbV
Try this a simple and less code version.
.circle-button {
border-radius: 100%;
border: 3px solid #000;
display: inline-block;
padding: 20px 30px;
font-size: 50px;
}
.circle-button:after {
content: "\274c";
}
<div class="circle-button"></div>
Ok, so everyone knows you can make a triangle using this:
#triangle {
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid red;
}
And that produces a solid, filled in triangle. But how would you make a hollow-type arrow-like triangle, like this?
You can use the before or after pseudo-element and apply some CSS to it. There are various ways. You can add both before and after, and rotate and position each of them to form one of the bars. An easier solution is adding two borders to just the before element and rotate it using transform: rotate.
Scroll down for a different solution that uses an actual element instead of the pseuso elements
In this case, I've added the arrows as bullets in a list and used em sizes to make them size properly with the font of the list.
ul {
list-style: none;
}
ul.big {
list-style: none;
font-size: 300%
}
li::before {
position: relative;
/* top: 3pt; Uncomment this to lower the icons as requested in comments*/
content: "";
display: inline-block;
/* By using an em scale, the arrows will size with the font */
width: 0.4em;
height: 0.4em;
border-right: 0.2em solid black;
border-top: 0.2em solid black;
transform: rotate(45deg);
margin-right: 0.5em;
}
/* Change color */
li:hover {
color: red; /* For the text */
}
li:hover::before {
border-color: red; /* For the arrow (which is a border) */
}
<ul>
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
<li>Item4</li>
</ul>
<ul class="big">
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
<li>Item4</li>
</ul>
Of course you don't need to use before or after, you can apply the same trick to a normal element as well. For the list above it is convenient, because you don't need additional markup. But sometimes you may want (or need) the markup anyway. You can use a div or span for that, and I've even seen people even recycle the i element for 'icons'. So that markup could look like below. Whether using <i> for this is right is debatable, but you can use span for this as well to be on the safe side.
/* Default icon formatting */
i {
display: inline-block;
font-style: normal;
position: relative;
}
/* Additional formatting for arrow icon */
i.arrow {
/* top: 2pt; Uncomment this to lower the icons as requested in comments*/
width: 0.4em;
height: 0.4em;
border-right: 0.2em solid black;
border-top: 0.2em solid black;
transform: rotate(45deg);
}
And so you can have an <i class="arrow" title="arrow icon"></i> in your text.
This arrow is <i class="arrow" title="arrow icon"></i> used to be deliberately lowered slightly on request.
I removed that for the general public <i class="arrow" title="arrow icon"></i> but you can uncomment the line with 'top' <i class="arrow" title="arrow icon"></i> to restore that effect.
If you seek more inspiration, make sure to check out this awesome library of pure CSS icons by Nicolas Gallagher. :)
This can be solved much easier than the other suggestions.
Simply draw a square and apply a border property to just 2 joining sides.
Then rotate the square according to the direction you want the arrow to point, for exaple: transform: rotate(<your degree here>)
.triangle {
border-right: 10px solid;
border-bottom: 10px solid;
height: 30px;
width: 30px;
transform: rotate(-45deg);
}
<div class="triangle"></div>
Responsive Chevrons / arrows
they resize automatically with your text and are colored the same color. Plug and play :)
jsBin demo playground
body{
font-size: 25px; /* Change font and see the magic! */
color: #f07; /* Change color and see the magic! */
}
/* RESPONSIVE ARROWS */
[class^=arr-]{
border: solid currentColor;
border-width: 0 .2em .2em 0;
display: inline-block;
padding: .20em;
}
.arr-right {transform:rotate(-45deg);}
.arr-left {transform:rotate(135deg);}
.arr-up {transform:rotate(-135deg);}
.arr-down {transform:rotate(45deg);}
This is <i class="arr-right"></i> .arr-right<br>
This is <i class="arr-left"></i> .arr-left<br>
This is <i class="arr-up"></i> .arr-up<br>
This is <i class="arr-down"></i> .arr-down
Here's a different approach:
1) Use the multiplication character: × ×
2) Hide half of it with overflow:hidden
3) Then add a triangle as a pseudo element for the tip.
The advantage here is that no transforms are necessary. (It will work in IE8+)
FIDDLE
.arrow {
position: relative;
}
.arrow:before {
content: '×';
display: inline-block;
position: absolute;
font-size: 240px;
font-weight: bold;
font-family: verdana;
width: 103px;
height: 151px;
overflow: hidden;
line-height: 117px;
}
.arrow:after {
content: '';
display: inline-block;
position: absolute;
left: 101px;
top: 51px;
width: 0;
height: 0;
border-style: solid;
border-width: 25px 0 25px 24px;
border-color: transparent transparent transparent black;
}
<div class="arrow"></div>
Just use before and after Pseudo-elements - CSS
*{box-sizing: border-box; padding: 0; margin: 0}
:root{background: white; transition: background .3s ease-in-out}
:root:hover{background: red }
div{
margin: 20px auto;
width: 150px;
height: 150px;
position:relative
}
div:before, div:after{
content: '';
position: absolute;
width: 75px;
height: 20px;
background: black;
left: 40px
}
div:before{
top: 45px;
transform: rotateZ(45deg)
}
div:after{
bottom: 45px;
transform: rotateZ(-45deg)
}
<div/>
An other approach using borders and no CSS3 properties :
div, div:after{
border-width: 80px 0 80px 80px;
border-color: transparent transparent transparent #000;
border-style:solid;
position:relative;
}
div:after{
content:'';
position:absolute;
left:-115px; top:-80px;
border-left-color:#fff;
}
<div></div>
> itself is very wonderful arrow! Just prepend a div with it and style it.
div{
font-size:50px;
}
div::before{
content:">";
font: 50px 'Consolas';
font-weight:900;
}
<div class="arrowed">Hatz!</div>
Left Right Arrow with hover effect using Roko C. Buljan box-shadow trick
.arr {
display: inline-block;
padding: 1.2em;
box-shadow: 8px 8px 0 2px #777 inset;
}
.arr.left {
transform: rotate(-45deg);
}
.arr.right {
transform: rotate(135deg);
}
.arr:hover {
box-shadow: 8px 8px 0 2px #000 inset
}
<div class="arr left"></div>
<div class="arr right"></div>
I needed to change an input to an arrow in my project. Below is final work.
#in_submit {
background-color: white;
border-left: #B4C8E9;
border-top: #B4C8E9;
border-right: 3px solid black;
border-bottom: 3px solid black;
width: 15px;
height: 15px;
transform: rotate(-45deg);
margin-top: 4px;
margin-left: 4px;
position: absolute;
cursor: pointer;
}
<input id="in_submit" type="button" class="convert_btn">
Here Fiddle
.arrow {
display : inline-block;
font-size: 10px; /* adjust size */
line-height: 1em; /* adjust vertical positioning */
border: 3px solid #000000;
border-left: transparent;
border-bottom: transparent;
width: 1em; /* use font-size to change overall size */
height: 1em; /* use font-size to change overall size */
}
.arrow:before {
content: "\00a0"; /* needed to hook line-height to "something" */
}
.arrow.left {
margin-left: 0.5em;
-webkit-transform: rotate(225deg);
-moz-transform: rotate(225deg);
-o-transform: rotate(225deg);
-ms-transform: rotate(225deg);
transform: rotate(225deg);
}
.arrow.right {
margin-right: 0.5em;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.arrow.top {
line-height: 0.5em; /* use this to adjust vertical positioning */
margin-left: 0.5em;
margin-right: 0.5em;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.arrow.bottom {
line-height: 2em;
/* use this to adjust vertical positioning */
margin-left: 0.5em;
margin-right: 0.5em;
-webkit-transform: rotate(135deg);
-moz-transform: rotate(135deg);
-o-transform: rotate(135deg);
-ms-transform: rotate(135deg);
transform: rotate(135deg);
}
<div>
here are some arrows
<div class='arrow left'></div> space
<div class='arrow right'></div> space
<div class='arrow top'></div> space
<div class='arrow bottom'></div> space with proper spacing?
</div>
Similar to Roko C, but a little more control over size and placement.
I'm having a slight problem with css. I need a trapezoid div which upper left corner(the one with the angle above 90 degrees) is rounded. I already know that this:
HTML:
<div style="margin:30px">
<div class="trapezoid">
</div>
</div>
CSS:
.trapezoid{
vertical-align: middle;
border-bottom: 31px solid red;
border-left: 25px solid transparent;
height: 0;
width: 150px;
}
produces a trapezoid. I tried the border-top-left-radius property, however the effect is not sufficent enough.
Here's a jsfiddle with the above code to, well, fiddle with: http://jsfiddle.net/n3TLP/5/
I there is more info needed just comment.
Thanks in advance :)
Not that you should ever do this, but you can also create a rounded corner trapezoid with a single element by applying CSS 3d transformations:
.trapezoid {
position: relative;
width: 300px;
height: 200px;
overflow: hidden;
}
.trapezoid:after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 200%;
height: 100%;
background: red;
border-radius: 20px 0 0 0;
-webkit-transform-origin: 100% 100%;
-moz-transform-origin: 100% 100%;
-ms-transform-origin: 100% 100%;
-o-transform-origin: 100% 100%;
transform-origin: 100% 100%;
-webkit-transform: perspective(400px) rotateX(45deg);
-moz-transform: perspective(400px) rotateX(45deg);
-ms-transform: perspective(400px) rotateX(45deg);
-o-transform: perspective(400px) rotateX(45deg);
transform: perspective(400px) rotateX(45deg);
}
http://jsfiddle.net/RzJTP/
Although I think you're better off using <canvas>/SVG to draw this shape, this is close to what you want:
.trapezoid{
vertical-align: middle;
border-bottom: 120px solid red;
border-left: 200px solid transparent;
border-top-left-radius:30px;
height: 0;
width: 150px;}
/* ---------- */
.trapezoid {
position:relative;
}
.trapezoid:after {
content:' ';
left:-14px;
top:-10px;
position:absolute;
background:red;
border-radius:40px 0 0 0;
width:164px;
height:40px;
display:block;
}
Demo: http://jsfiddle.net/n3TLP/20/
It's not perfect, and you'll have to play with the numbers to get your desired dimensions, it's very finicky. You might be interested in something like Raphaël for drawing, CSS doesn't really have the capacity for complex shapes (at least not intentionally).
Voila:
css:
.trapezoid{
vertical-align: middle;
background: red;
padding-left: 200px;
height: 120px;
width: 150px;
position: relative;
border-top-left-radius: 40px;
overflow: hidden;
background-clip: content-box;
}
.trapezoid:after{
content: '';
margin-left: -100px;
top: 0;
height: 120px;
background: red;
transform: skew(-31deg,0deg);
-o-transform: skew(-31deg,0deg);
-ms-transform: skew(-31deg,0deg);
-moz-transform: skew(-31deg,0deg);
-webkit-transform: skew(-59deg,0deg);
position: absolute;
width: 1000px;
border-top-left-radius: 40px;
}
Demo:
http://jsfiddle.net/n3TLP/24/
Here's my attempt lol
.trapezoid{
position:relative;
border-bottom: 100px solid blue;
border-right: 12px solid transparent;
border-left: 180px solid transparent;
width: 122px;
}
.trapezoid:before{
content:' ';
left:-184px;
top:98px;
position:absolute;
background:blue;
border-radius:80px 20px 80px 80px;
width:318px;
height:20px;
}
.trapezoid:after {
content:' ';
left:-11px;
top:-7px;
position:absolute;
background:blue;
border-radius:150px 50px 90px 0px;
width:133px;
height:30px;
}
<div style="margin:30px">
<div class="trapezoid">
</div>
</div>
http://jsfiddle.net/Bzj3h/
Use Adobe Illustrator or any other software to draw a shape and than save it as SVG code, you can use SVG directly on the page but IE8 and lower will ignore it. If you need to support older versions of IE you can use Raphael.js to draw your SVG element.
Rendering SVG polygons in Raphael Javascript library
Ok, so everyone knows you can make a triangle using this:
#triangle {
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid red;
}
And that produces a solid, filled in triangle. But how would you make a hollow-type arrow-like triangle, like this?
You can use the before or after pseudo-element and apply some CSS to it. There are various ways. You can add both before and after, and rotate and position each of them to form one of the bars. An easier solution is adding two borders to just the before element and rotate it using transform: rotate.
Scroll down for a different solution that uses an actual element instead of the pseuso elements
In this case, I've added the arrows as bullets in a list and used em sizes to make them size properly with the font of the list.
ul {
list-style: none;
}
ul.big {
list-style: none;
font-size: 300%
}
li::before {
position: relative;
/* top: 3pt; Uncomment this to lower the icons as requested in comments*/
content: "";
display: inline-block;
/* By using an em scale, the arrows will size with the font */
width: 0.4em;
height: 0.4em;
border-right: 0.2em solid black;
border-top: 0.2em solid black;
transform: rotate(45deg);
margin-right: 0.5em;
}
/* Change color */
li:hover {
color: red; /* For the text */
}
li:hover::before {
border-color: red; /* For the arrow (which is a border) */
}
<ul>
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
<li>Item4</li>
</ul>
<ul class="big">
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
<li>Item4</li>
</ul>
Of course you don't need to use before or after, you can apply the same trick to a normal element as well. For the list above it is convenient, because you don't need additional markup. But sometimes you may want (or need) the markup anyway. You can use a div or span for that, and I've even seen people even recycle the i element for 'icons'. So that markup could look like below. Whether using <i> for this is right is debatable, but you can use span for this as well to be on the safe side.
/* Default icon formatting */
i {
display: inline-block;
font-style: normal;
position: relative;
}
/* Additional formatting for arrow icon */
i.arrow {
/* top: 2pt; Uncomment this to lower the icons as requested in comments*/
width: 0.4em;
height: 0.4em;
border-right: 0.2em solid black;
border-top: 0.2em solid black;
transform: rotate(45deg);
}
And so you can have an <i class="arrow" title="arrow icon"></i> in your text.
This arrow is <i class="arrow" title="arrow icon"></i> used to be deliberately lowered slightly on request.
I removed that for the general public <i class="arrow" title="arrow icon"></i> but you can uncomment the line with 'top' <i class="arrow" title="arrow icon"></i> to restore that effect.
If you seek more inspiration, make sure to check out this awesome library of pure CSS icons by Nicolas Gallagher. :)
This can be solved much easier than the other suggestions.
Simply draw a square and apply a border property to just 2 joining sides.
Then rotate the square according to the direction you want the arrow to point, for exaple: transform: rotate(<your degree here>)
.triangle {
border-right: 10px solid;
border-bottom: 10px solid;
height: 30px;
width: 30px;
transform: rotate(-45deg);
}
<div class="triangle"></div>
Responsive Chevrons / arrows
they resize automatically with your text and are colored the same color. Plug and play :)
jsBin demo playground
body{
font-size: 25px; /* Change font and see the magic! */
color: #f07; /* Change color and see the magic! */
}
/* RESPONSIVE ARROWS */
[class^=arr-]{
border: solid currentColor;
border-width: 0 .2em .2em 0;
display: inline-block;
padding: .20em;
}
.arr-right {transform:rotate(-45deg);}
.arr-left {transform:rotate(135deg);}
.arr-up {transform:rotate(-135deg);}
.arr-down {transform:rotate(45deg);}
This is <i class="arr-right"></i> .arr-right<br>
This is <i class="arr-left"></i> .arr-left<br>
This is <i class="arr-up"></i> .arr-up<br>
This is <i class="arr-down"></i> .arr-down
Here's a different approach:
1) Use the multiplication character: × ×
2) Hide half of it with overflow:hidden
3) Then add a triangle as a pseudo element for the tip.
The advantage here is that no transforms are necessary. (It will work in IE8+)
FIDDLE
.arrow {
position: relative;
}
.arrow:before {
content: '×';
display: inline-block;
position: absolute;
font-size: 240px;
font-weight: bold;
font-family: verdana;
width: 103px;
height: 151px;
overflow: hidden;
line-height: 117px;
}
.arrow:after {
content: '';
display: inline-block;
position: absolute;
left: 101px;
top: 51px;
width: 0;
height: 0;
border-style: solid;
border-width: 25px 0 25px 24px;
border-color: transparent transparent transparent black;
}
<div class="arrow"></div>
Just use before and after Pseudo-elements - CSS
*{box-sizing: border-box; padding: 0; margin: 0}
:root{background: white; transition: background .3s ease-in-out}
:root:hover{background: red }
div{
margin: 20px auto;
width: 150px;
height: 150px;
position:relative
}
div:before, div:after{
content: '';
position: absolute;
width: 75px;
height: 20px;
background: black;
left: 40px
}
div:before{
top: 45px;
transform: rotateZ(45deg)
}
div:after{
bottom: 45px;
transform: rotateZ(-45deg)
}
<div/>
An other approach using borders and no CSS3 properties :
div, div:after{
border-width: 80px 0 80px 80px;
border-color: transparent transparent transparent #000;
border-style:solid;
position:relative;
}
div:after{
content:'';
position:absolute;
left:-115px; top:-80px;
border-left-color:#fff;
}
<div></div>
> itself is very wonderful arrow! Just prepend a div with it and style it.
div{
font-size:50px;
}
div::before{
content:">";
font: 50px 'Consolas';
font-weight:900;
}
<div class="arrowed">Hatz!</div>
Left Right Arrow with hover effect using Roko C. Buljan box-shadow trick
.arr {
display: inline-block;
padding: 1.2em;
box-shadow: 8px 8px 0 2px #777 inset;
}
.arr.left {
transform: rotate(-45deg);
}
.arr.right {
transform: rotate(135deg);
}
.arr:hover {
box-shadow: 8px 8px 0 2px #000 inset
}
<div class="arr left"></div>
<div class="arr right"></div>
I needed to change an input to an arrow in my project. Below is final work.
#in_submit {
background-color: white;
border-left: #B4C8E9;
border-top: #B4C8E9;
border-right: 3px solid black;
border-bottom: 3px solid black;
width: 15px;
height: 15px;
transform: rotate(-45deg);
margin-top: 4px;
margin-left: 4px;
position: absolute;
cursor: pointer;
}
<input id="in_submit" type="button" class="convert_btn">
Here Fiddle
.arrow {
display : inline-block;
font-size: 10px; /* adjust size */
line-height: 1em; /* adjust vertical positioning */
border: 3px solid #000000;
border-left: transparent;
border-bottom: transparent;
width: 1em; /* use font-size to change overall size */
height: 1em; /* use font-size to change overall size */
}
.arrow:before {
content: "\00a0"; /* needed to hook line-height to "something" */
}
.arrow.left {
margin-left: 0.5em;
-webkit-transform: rotate(225deg);
-moz-transform: rotate(225deg);
-o-transform: rotate(225deg);
-ms-transform: rotate(225deg);
transform: rotate(225deg);
}
.arrow.right {
margin-right: 0.5em;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.arrow.top {
line-height: 0.5em; /* use this to adjust vertical positioning */
margin-left: 0.5em;
margin-right: 0.5em;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.arrow.bottom {
line-height: 2em;
/* use this to adjust vertical positioning */
margin-left: 0.5em;
margin-right: 0.5em;
-webkit-transform: rotate(135deg);
-moz-transform: rotate(135deg);
-o-transform: rotate(135deg);
-ms-transform: rotate(135deg);
transform: rotate(135deg);
}
<div>
here are some arrows
<div class='arrow left'></div> space
<div class='arrow right'></div> space
<div class='arrow top'></div> space
<div class='arrow bottom'></div> space with proper spacing?
</div>
Similar to Roko C, but a little more control over size and placement.
This question already has answers here:
draw diagonal lines in div background with CSS
(13 answers)
Closed 8 years ago.
I need to draw in my div diagonal line. It should look like this:
My HTML:
<div style="height: 28px; width: 28px; border: 1px solid rgb(219,225,230);background-color:white;" >
</div>
Is it possible to do it only with CSS?
You can achieve the desired effect by using just one single div. Check the DEMO.
div{
border:1px solid gray;
width:28px;
height:28px;
position:relative;
}
div:after{
content:"";
position:absolute;
border-top:1px solid red;
width:40px;
transform: rotate(45deg);
transform-origin: 0% 0%;
}
Note: please add the vendor prefix for older browsers i.e. -moz, -webkit.
Using CSS transform property you can achieve this. Look at the following HTML and CSS.
HTML
<div style="border: 1px solid #000; width:100px; height:100px;">
<div id="hr" style="border-top:1px solid #ff00ff; height:100px; margin-left:-140px;"></div>
</div>
CSS
#hr {
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
DEMO
You could also use two elements and theirs borders like that :
The HTML :
<div class="top-left">
<div class="cross-a"></div>
<div class="cross-b"></div>
</div>
The CSS :
.top-left {
position: absolute;
top: 0;
left: 0;
height: 28px;
width: 28px;
border-top: solid 2px #fff;
border-left: solid 2px #fff;
}
.cross-a, .cross-b {
position:absolute;
width:0;
height:0;
}
.cross-a {
top: -2px;
left: -2px;
border-top: 28px solid transparent;
border-right: 28px solid #000;
}
.cross-b {
top: 0px;
left: 0px;
border-top: 26px solid transparent;
border-right: 26px solid #FFFFFF;
}
The fiddle : http://jsfiddle.net/9yK6q/7/
You could use a hr element or a other element and rotate it.
Here is a demo: http://jsfiddle.net/9HXTe/
div, hr {
-moz-transform: rotate(7.5deg);
-o-transform: rotate(7.5deg);
-webkit-transform: rotate(7.5deg);
-ms-transform: rotate(7.5deg);
transform: rotate(7.5deg);
}