Note that there are some explanatory texts on larger screens.

plurals
  1. POReplicate image in CSS and HTML only
    primarykey
    data
    text
    <p>For a code quiz I am trying to replicate the attached image using CSS and HTML only. The gradients and borders seem to be working out fine, but I am having trouble getting the ribbon edges to look curved.</p> <p>Here is my markup:</p> <pre><code>&lt;div class="container"&gt; &lt;div class="ribbon-wrapper-green"&gt;&lt;div class="ribbon-green"&gt;AWESOME!&lt;/div&gt;&lt;/div&gt; &lt;div class="ribbon-bottom-left"&gt;&lt;/div&gt; &lt;div class="bottom-left-gradient"&gt;&lt;/div&gt; </code></pre> <p></p> <p>And here is my CSS:</p> <pre><code> .container { width:300px; height:300px; margin-left:auto; margin-right:auto; margin-top:10px; position:relative; border:#CCC 1px solid; background-color:#EBEBEB; box-shadow:1px 1px 1px #CCC; } .ribbon-wrapper-green { width: 290px; height: 290px; overflow: hidden; position: absolute; top: -3px; right: -3px; } .ribbon-green { font: 25px Arial; text-align: center; text-shadow:0px 0px 6px #000; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); -o-transform: rotate(45deg); position: relative; padding: 20px 0; left: 7px; top: 66px; width: 363px; background-color: #BFDC7A; background-image: -webkit-gradient(linear, left top, left bottom, from(#BFDC7A), to(#8EBF45)); background-image: -webkit-linear-gradient(top, #BFDC7A, #8EBF45); background-image: -moz-linear-gradient(top, #BFDC7A, #8EBF45); background-image: -ms-linear-gradient(top, #BFDC7A, #8EBF45); background-image: -o-linear-gradient(top, #BFDC7A, #8EBF45); color: #FFF; -webkit-box-shadow: 0px 8px 20px rgba(0,0,0,0.3); -moz-box-shadow: 0px 8px 20px rgba(0,0,0,0.3); box-shadow: 0px 8px 20px rgba(0,0,0,0.3); } .ribbon-green:before, .ribbon-green:after { content: ""; border-top: 4px solid #6e8900; border-left: 4px solid transparent; border-right: 4px solid transparent; position:absolute; bottom: -4px; } .ribbon-green:before { left: 0; } .ribbon-green:after { right: 0; } .ribbon-bottom-left { width: 0px; height: 0px; border-style: solid; border-width: 250px 0 0 250px; border-color: transparent transparent transparent #D32023; position:absolute; bottom:-5px; left:-5px; border-top-left-radius:10px; border-bottom-right-radius:10px; -moz-border-radius-topleft:10px; -moz-border-radius-bottomright:10px; z-index:1; } .bottom-left-gradient { position:absolute; bottom:-8px; left:-8px; z-index:100; height:245px; width:245px; opacity:0.4; filter:alpha(opacity=40); background: -moz-linear-gradient(45deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.92) 4%, rgba(255,255,255,0) 51%); /* FF3.6+ */ background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,rgba(255,255,255,1)), color-stop(4%,rgba(255,255,255,0.92)), color-stop(51%,rgba(255,255,255,0))); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(45deg, rgba(255,255,255,1) 0%,rgba(255,255,255,0.92) 4%,rgba(255,255,255,0) 51%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(45deg, rgba(255,255,255,1) 0%,rgba(255,255,255,0.92) 4%,rgba(255,255,255,0) 51%); /* Opera 11.10+ */ background: -ms-linear-gradient(45deg, rgba(255,255,255,1) 0%,rgba(255,255,255,0.92) 4%,rgba(255,255,255,0) 51%); /* IE10+ */ background: linear-gradient(45deg, rgba(255,255,255,1) 0%,rgba(255,255,255,0.92) 4%,rgba(255,255,255,0) 51%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#00ffffff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */ border-style:solid; border-width:0 0 5px 5px; border-radius:10px; -moz-border-radius:10px; border-color:#E41316; } </code></pre> <p>The image is coming out like this example here: <a href="http://arunsood.me/code-quizzes/placebo-effect/" rel="nofollow noreferrer">http://arunsood.me/code-quizzes/placebo-effect/</a>.</p> <p>The original I need to copy is below. How can I achieve the edge bending effect via CSS alone?</p> <p><img src="https://i.stack.imgur.com/qPXBx.jpg" alt="Original Image"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    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