Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I understand that an answer has been accepted for your question already, but I thought I could provide my two cents, just for the sake of completeness.</p> <p>While there is no inherent problem with creating an additional <code>&lt;div&gt;</code> element to hold the text, I prefer using the <code>::after</code> pseudo-element to create one. It's probably (IMHO) more semantically correct, but it really depends what purpose you want the text to serve as.</p> <p>In my example, I have placed the text you want to appear in the background in a HTML data- attribute, say, <code>data-bg-text</code>:</p> <pre><code>&lt;div class="bg-text" data-bg-text="text"&gt; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi eu quam dolor, et aliquet lectus. &lt;/div&gt; </code></pre> <p>And for your CSS, you simply have to create a pseudo-element, and assign content from the custom HTML data- attribute:</p> <pre><code>.bg-text { background-color: #aaa; overflow: hidden; padding: 20px 20px 100px 20px; position: relative; width: 400px; } .bg-text::after { color: #fff; content: attr(data-bg-text); display: block; font-size: 80px; line-height: 1; position: absolute; bottom: -15px; right: 10px; } </code></pre> <p>See the fiddle here - <a href="http://jsfiddle.net/teddyrised/n58D9/" rel="nofollow noreferrer">http://jsfiddle.net/teddyrised/n58D9/</a> or check the proof-of-concept example below:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.bg-text { background-color: #aaa; padding: 20px 20px 100px 20px; position: relative; width: 400px; overflow: hidden; } .bg-text::after { color: #000; content: attr(data-bg-text); display: block; font-size: 80px; line-height: 1; position: absolute; bottom: -15px; right: 10px; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="bg-text" data-bg-text="text"&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi eu quam dolor, et aliquet lectus.&lt;/div&gt;</code></pre> </div> </div> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload