Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Geometric Parrot
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Markshall" data-source="post: 441000" data-attributes="member: 1872"><p>I saw a neat little illustration on Dribbble and wanted to code it up in CSS form. This is my result... would be a lot smoother if I spent more time on it but I knocked it up in about 10 minutes so it's only a quick one.</p><p></p><p>I've always wanted to do an illustration>CSS mock up but never found one that looks simple enough until this one</p><p></p><p>I wanted to do it with as little divs as I could. I managed 3:</p><ol> <li data-xf-list-type="ol">The main parrot body container which is the blue/off-purple background</li> <li data-xf-list-type="ol">The head which is the circular part split in 2 (pink part is <span style="font-family: 'courier new'">::before</span>, yellow part is <span style="font-family: 'courier new'">::after</span>. The head div also has an <span style="font-family: 'courier new'">box-shadow</span> to create the curvature on the parrot's body</li> <li data-xf-list-type="ol">And the eye which is originally pink but has a white <span style="font-family: 'courier new'">box-shadow</span> to match the design. It also has an <span style="font-family: 'courier new'">::after</span> to make the bottom part of the yellow beak seem transparent</li> </ol><p></p><p><a href="https://dribbble.com/shots/5565612-C-Parrot" target="_blank">Original design (click)</a>:</p><p><img src="https://i.sharefa.st/IKyswM2VlZD3.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p><a href="https://codepen.io/Markshall/pen/vQezYa" target="_blank">My CSS result (click)</a>:</p><p><img src="https://i.sharefa.st/moagsHOtkZD3.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>CSS:</p><p>[PHP].parrot {</p><p> height: 200px;</p><p> width: 200px;</p><p> background-color: #323656;</p><p> border-radius: 50%;</p><p> position: relative;</p><p> overflow: hidden;</p><p>}</p><p></p><p> .head {</p><p> position: absolute;</p><p> top: 20px; right: 7px;</p><p> height: 110px;</p><p> width: 110px;</p><p> border-radius: 50%;</p><p> overflow: hidden;</p><p> transform: rotate(45deg);</p><p> box-shadow: 70px -76px 0 20px #f8f6f4;</p><p> border: none;</p><p> }</p><p></p><p> .head::before {</p><p> background-color: #ff587a;</p><p> position: absolute;</p><p> top: 0; left: 0;</p><p> width: 100%;</p><p> height: 100%;</p><p> content: '';</p><p> display: block;</p><p> }</p><p></p><p> .head::after {</p><p> background-color: #ffca78;</p><p> position: absolute;</p><p> top: 0; left: calc(50% - 1px);</p><p> width: 100%;</p><p> height: 100%;</p><p> content: '';</p><p> display: block;</p><p> }</p><p></p><p> .eye {</p><p> position: absolute;</p><p> height: 15px;</p><p> width: 15px;</p><p> top: 27px; left: 25px;</p><p> box-shadow: 0 0 0 8px #fff;</p><p> background-color: #ff587a;</p><p> border-radius: 50%;</p><p> }</p><p></p><p> .eye::after {</p><p> background-color: #f8f6f4;</p><p> height: 110px;</p><p> width: 110px;</p><p> position: absolute;</p><p> border-radius: 50%;</p><p> z-index: 2;</p><p> top: 25px; left: 30px;</p><p> content: '';</p><p> display: block;</p><p> }</p><p></p><p>body {</p><p> background-color: #f8f6f4;</p><p> margin: 0;</p><p> position: relative;</p><p> height: 100vh;</p><p>}</p><p></p><p>.bird-cage {</p><p> position: absolute;</p><p> top: 50%; left: 50%;</p><p> transform: translate(-50%, -50%);</p><p>}[/PHP]</p><p></p><p>HTML:</p><p>[PHP]<div class="bird-cage"></p><p> <div class="parrot"></p><p> <div class="head"></p><p> <div class="eye"></div></p><p> </div></p><p> </div></p><p></div>[/PHP]</p><p></p><p>Thoughts? And how would you have done it differently in order to curve out the body. <a href="https://codepen.io/Markshall/pen/vQezYa" target="_blank">Feel free to fork my pen</a></p></blockquote><p></p>
[QUOTE="Markshall, post: 441000, member: 1872"] I saw a neat little illustration on Dribbble and wanted to code it up in CSS form. This is my result... would be a lot smoother if I spent more time on it but I knocked it up in about 10 minutes so it's only a quick one. I've always wanted to do an illustration>CSS mock up but never found one that looks simple enough until this one I wanted to do it with as little divs as I could. I managed 3: [LIST=1] [*]The main parrot body container which is the blue/off-purple background [*]The head which is the circular part split in 2 (pink part is [FONT=courier new]::before[/FONT], yellow part is [FONT=courier new]::after[/FONT]. The head div also has an [FONT=courier new]box-shadow[/FONT] to create the curvature on the parrot's body [*]And the eye which is originally pink but has a white [FONT=courier new]box-shadow[/FONT] to match the design. It also has an [FONT=courier new]::after[/FONT] to make the bottom part of the yellow beak seem transparent [/LIST] [URL='https://dribbble.com/shots/5565612-C-Parrot']Original design (click)[/URL]: [IMG]https://i.sharefa.st/IKyswM2VlZD3.png[/IMG] [URL='https://codepen.io/Markshall/pen/vQezYa']My CSS result (click)[/URL]: [IMG]https://i.sharefa.st/moagsHOtkZD3.png[/IMG] CSS: [PHP].parrot { height: 200px; width: 200px; background-color: #323656; border-radius: 50%; position: relative; overflow: hidden; } .head { position: absolute; top: 20px; right: 7px; height: 110px; width: 110px; border-radius: 50%; overflow: hidden; transform: rotate(45deg); box-shadow: 70px -76px 0 20px #f8f6f4; border: none; } .head::before { background-color: #ff587a; position: absolute; top: 0; left: 0; width: 100%; height: 100%; content: ''; display: block; } .head::after { background-color: #ffca78; position: absolute; top: 0; left: calc(50% - 1px); width: 100%; height: 100%; content: ''; display: block; } .eye { position: absolute; height: 15px; width: 15px; top: 27px; left: 25px; box-shadow: 0 0 0 8px #fff; background-color: #ff587a; border-radius: 50%; } .eye::after { background-color: #f8f6f4; height: 110px; width: 110px; position: absolute; border-radius: 50%; z-index: 2; top: 25px; left: 30px; content: ''; display: block; } body { background-color: #f8f6f4; margin: 0; position: relative; height: 100vh; } .bird-cage { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }[/PHP] HTML: [PHP]<div class="bird-cage"> <div class="parrot"> <div class="head"> <div class="eye"></div> </div> </div> </div>[/PHP] Thoughts? And how would you have done it differently in order to curve out the body. [URL='https://codepen.io/Markshall/pen/vQezYa']Feel free to fork my pen[/URL] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Geometric Parrot
Top