Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>EDIT: </p> <p><strong>Solution n.2:</strong> </p> <p>you could even use two divs, one "outer" with the gradient background, the optional shadow, and the rounded borders, and one "inner" with white background containing your stuff.</p> <p>Demo: <a href="http://jsfiddle.net/TqutW/4/" rel="nofollow noreferrer">http://jsfiddle.net/TqutW/4/</a></p> <p>HTML</p> <pre><code>&lt;div class="windowBorder" &gt; &lt;div class="windowContent" &gt; &lt;div &gt;xxxxxxxxxxxxxxx&lt;/div&gt; &lt;div &gt;xxxxxxxxxxxxxxx&lt;/div&gt; &lt;div &gt;xxxxxxxxxxxxxxx&lt;/div&gt; &lt;div &gt;xxxxxxxxxxxxxxx&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS (crossbrowser)</p> <pre><code>.windowBorder{ margin: 30px; padding: 20px 8px 8px 8px; box-shadow: 2px 2px 5px 1px #111111; border-radius: 10px; background: #7d7e7d; /* Old browsers */ background: -moz-linear-gradient(top, #7d7e7d 0%, #0e0e0e 13%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#7d7e7d), color-stop(13%,#0e0e0e)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #7d7e7d 0%,#0e0e0e 13%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #7d7e7d 0%,#0e0e0e 13%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, #7d7e7d 0%,#0e0e0e 13%); /* IE10+ */ background: linear-gradient(to bottom, #7d7e7d 0%,#0e0e0e 13%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7d7e7d', endColorstr='#0e0e0e',GradientType=0 ); /* IE6-9 */ } .windowContent { padding: 10px; background-color: white; } </code></pre> <p>You only need to create the div(s) around your content via javascript...</p> <hr> <p><strong>Solution n. 1</strong></p> <p>You don't really need to use images <em>for this</em>. </p> <p>(you would need to use images, for example, with a "wood" border, then you should do it in the old-school way... an image for every angle, one image for the vertical line, one for the horizontal line, and a lot of divs...)</p> <p>All you have here is a gradient (achievable using <code>CSS3 Gradients</code>) and rounded borders (achiaveble using <code>CSS3 border-radius</code>). You can add shadow too with <code>CSS3 box-shadow</code>...</p> <p>Gradients are easily generated with the <a href="http://www.colorzilla.com/gradient-editor/" rel="nofollow noreferrer">CSS3 Gradient Generator</a>, but today they're cross-browser for <code>BACKGROUND</code> attribute only... you can <a href="https://stackoverflow.com/questions/2717127/css3-gradient-borders">use gradient on BORDERS in webkit browsers</a>, not yet in FF nor IE... but you can add a div as the header of the window, with a gradient background.</p> <p>This is a fiddle for wrap content inside a window with rounded border and shadow (with no gradients):</p> <p><a href="http://jsfiddle.net/TqutW/3/" rel="nofollow noreferrer">http://jsfiddle.net/TqutW/3/</a></p> <p>And the only javascript needed is the one that applies the new class to the container div... enjoy.</p> <p>HTML</p> <pre><code> &lt;div id="container1"&gt; &lt;div &gt;xxxxxxxxxxxxxxx&lt;/div&gt; &lt;div &gt;xxxxxxxxxxxxxxx&lt;/div&gt; &lt;div &gt;xxxxxxxxxxxxxxx&lt;/div&gt; &lt;div &gt;xxxxxxxxxxxxxxx&lt;/div&gt; &lt;/div&gt; &lt;br/&gt; &lt;input type="button" id="click" value="windowization! :)"/&gt; </code></pre> <p>CSS</p> <pre><code>.window{ margin: 30px; padding: 10px; border-style: solid; border-width: 20px 8px 8px 8px; border-color: #444; border-radius: 10px; box-shadow: 2px 2px 10px 1px #111111; } </code></pre> <p>JS</p> <pre><code>document.getElementById("click").onclick=function(){ document.getElementById("container1").className+=" window "; } </code></pre>
    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