Skip to content

Ode to STEM

  • Home
  • About

Day 7

Pure CSS Art: Day 7

After returning from an awesome day at Google’s Summit for Women in Computing, I was inspired to create something Google-related. The Android logo was a good candidate, as it contains simple shapes such as rectangles and circles.

AndroidLogoCSS

See Codepen

Takeaways: 

  • Initially, I was going to create a full circle, and then use another shape to cover the half of the circle to create the head; however, I knew there must be a way to create a half-circle (and I didn’t want to use Clippy either); a quick Google search led me to find this Codepen  , where I learned that the border-radius property could be further specified i.e. border-bottom-left-radius, border-bottom-right-radius, bottom-top-left-radius, bottom-top-right-radius 
  • To create a half-circle, the bottom/top-left/right-radius property must be double the width of the circle {why, exactly? I have a vague notion}

androidlogoCSS_HEAD

  • To rotate a <div> element, use the transform property
  • Angles could be negative, just like in math; it rotates counterclockwise

androidlogo_transformdivEDIT

  • The top property’s value could also be negative — the shape moves upward

 

Questions: 

  • Why does the width have to be half the value of height for the eye to appear as a circle, even with border radius 50%?
  • Why does the bottom/top-left/right-radius property have to be double the width of the circle to create a half-circle?

 

For the future: 

  • Review how to absolutely center a shape (in both percentage and px)
  • Learn how to animate and rotate the Android bot’s head or arm or leg
Comment
September 23, 2017September 23, 2017 odetostem
Android logoArtCSSCSS ArtDay 7HTML
Blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Subscribe Subscribed
    • Ode to STEM
    • Already have a WordPress.com account? Log in now.
    • Ode to STEM
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...
 

    Design a site like this with WordPress.com
    Get started