Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Old paper background texture with just css

Tags:

Is it possible to create a background texture with pure CSS (without using an image) that looks like an old paper, e.g. like this: http://i.stack.imgur.com/kb0Zm.jpg

I'm aware that there are limitations, the texture does not need to be as complex as the example.

Is there a way to do this in CSS?

like image 603
Michael Avatar asked Jan 29 '13 14:01

Michael


People also ask

What is CSS styling background?

The CSS background property defines the initial position of the background-image for an element. It is a shorthand property for setting the background-color, background-image, background-repeat, background-attachment, and background-position CSS properties.


1 Answers

May I suggest my solution ? (tested on Chrome v92+, Firefox v90+, Edge v92+).

A bit of box shadow :

    #parchment {   position: absolute;   display: flex;     width: 75%;   min-height: calc((1vw + 1vh) * 75);   /* center page with absolute position */   top: 0%; left: 50%; transform: translate(-50%, 0);   margin: 2em 0;     padding: 4em;     box-shadow: 2px 3px 20px black, 0 0 60px #8a4d0f inset;     background: #fffef0;   filter: url(#wavy2); } 

and a bit of SVG feTurbulence as filter :

<svg>   <filter id="wavy2">     <feturbulence x="0" y="0" baseFrequency="0.02" numOctaves="5" seed="1"></feturbulence>     <feDisplacementMap in="SourceGraphic" scale="20" />   </filter> </svg> 

exemple there : Old parchment with a mix of css and svg

like image 185
Christophe Avatar answered Sep 18 '22 11:09

Christophe