Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slanted diagonal line in html or css?

I want to make a Table like this CSS diagonale strike

is it possible to add a slanted diagonal border in table?

like image 475
Datz Me Avatar asked Feb 10 '15 06:02

Datz Me


1 Answers

Another approach would be to use SVG as it can scale easily to the size of your container.

Example :

div {
  position: relative;
  display:inline-block;
  width: 100px;
  height: 50px;
  border: 1px solid #000;
}
.l{width:200px;}
.xl{width:300px;}
svg {
  position: absolute;
  width: 100%;
  height: 100%;
}
<div class="s">
  <svg viewBox="0 0 10 10" preserveAspectRatio="none">
    <line x1="0" y1="0" x2="10" y2="10" stroke="black" stroke-width="0.2" />
  </svg>
</div>
<div class="l">
  <svg viewBox="0 0 10 10" preserveAspectRatio="none">
    <line x1="0" y1="0" x2="10" y2="10" stroke="black" stroke-width="0.2" />
  </svg>
</div>
<div class="xl">
  <svg viewBox="0 0 10 10" preserveAspectRatio="none">
    <line x1="0" y1="0" x2="10" y2="10" stroke="black" stroke-width="0.2" />
  </svg>
</div>
like image 105
web-tiki Avatar answered Sep 20 '22 12:09

web-tiki