Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rotate repeating text at a 45 degree angle that isn't visible outside the element

Tags:

html

text

css

I'm trying to just have a word or phrase be repeated at a 45 degree angle downwards at a very low transparency, and have it cut off by the edges of the element. Just wondering if this is possible without just making an image in another program.

Something like this: rotated text downward

like image 676
Epuuc Avatar asked Oct 25 '25 11:10

Epuuc


1 Answers

You can use SVG to create the rotated text then apply it as background. You can easily control the size by adjusting the background-size value

html {
  min-height:100%;
  background: 
    url('data:image/svg+xml;utf8,<svg style="transform:rotate(45deg)" xmlns="http://www.w3.org/2000/svg"  viewBox="0 0 50 60"><text x="0" y="25" fill="%23000">Lorem </text></svg>') 
    0 0/50px 50px; /* update the 50px 50px to control the size */
}

Consider pseudo element to have it above all the content:

body:before {
  content:"";
  position:absolute;
  inset:0;
  opacity:0.8;
  background: 
    url('data:image/svg+xml;utf8,<svg style="transform:rotate(45deg)" xmlns="http://www.w3.org/2000/svg"  viewBox="0 0 50 60"><text x="0" y="25" fill="%23000">Epuuc </text></svg>') 
    0 0/60px 60px;
}

body {
  position:relative;
  background:purple;
  min-height:200vh;
}
like image 59
Temani Afif Avatar answered Oct 27 '25 02:10

Temani Afif



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!