Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Textured Text with CSS?

Tags:

css

I'm currently developing a simple page.

Does anyone know of any way to overlay a texture image over text? It seems like it's not possible with the current spec, but please let me know if this is possible.

Thanks and take care!

like image 726
John Calvin Avatar asked Sep 23 '10 14:09

John Calvin


People also ask

How do you texture text in CSS?

By using the -webkit-mask-image CSS property, you can set the image in a text. This is almost the same like the background-clip except that the mask image clips the visible portion of an element according to image mask transparency.


2 Answers

Dunno why nobody ever answered this. This is possible using background-clip: https://codepen.io/Grsmto/pen/ZomWEj

like image 160
adriendenat Avatar answered Sep 25 '22 08:09

adriendenat


You can't overlay an image over text with native CSS 2.1, That will not be implemented into CSS 3.0 either. The best practice is to use a background image and still use your text in the <h1> tag and hide it with CSS.

<style>
h1 { background:url(images/imagepath.png) no-repeat; height:50px; width:300px; text-indent:-10000px; }
</style>

<body>
   <h1>Insert Text Here</h1>
</body>
like image 25
Jon Harding Avatar answered Sep 22 '22 08:09

Jon Harding