Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Learn CSS: Create the Microsoft Logo (Version 2)
Jennifer Bland
Jennifer Bland

Posted on • Originally published atjenniferbland.com on

     

Learn CSS: Create the Microsoft Logo (Version 2)

One of the best ways to learn CSS is by creating something useful while you learn. I will show you how to use the following CSS items by creating the Microsoft logo:

  • box-shadow

In a previous article, I showed you how to create the Microsoft Logo using CSS Grid. In this article, I will show you how to create the same logo using thebox-shadow property.

What we will be creating

We will create the Microsoft logo in pure CSS. It will look like this:

Microsoft Logo

Create our starter files

Let's start by creating two files calledindex.html andstyle.css. In yourindex.html file add the following starter code:

<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"content="width=device-width, initial-scale=1.0"><title>Microsoft Logo v2</title><linkrel="stylesheet"href="style.css"></head><body></body></html>
Enter fullscreen modeExit fullscreen mode

In thestyle.css file add the following starter code:

body{padding:0;margin:0;height:100vh;display:flex;justify-content:center;align-items:center;background-color:azure;}
Enter fullscreen modeExit fullscreen mode

box-shadow

Thebox-shadow CSS property adds shadow effects around an element's frame. You can set multiple effects separated by commas. A box shadow is described by X and Y offsets relative to the element, blur and spread radius, and color.

We will take advantage of that by creating one square of the logo and then adding three shadows for the other squares.

Add the following one line inside thebody tag in yourindex.html file:

<divclass="microsoft-logo"></div>
Enter fullscreen modeExit fullscreen mode

Add this code to yourstyle.css file:

.microsoft-logo{background-color:#f25022;box-shadow:220px000#7fba00,0220px00#00a4ef,220px220px00#ffb900;height:200px;width:200px;}
Enter fullscreen modeExit fullscreen mode

The first line in thebox-shadow property creates a shadow 220px on the right side with a green color. Since our square is 200px wide and high, this starts the shadow 20px to the right of the initial box.

The 2nd line in thebox-shadow property creates a shadow 220px below the initial box and sets the color to blue.

The 3rd line in thebox-shadow property creates a shadow 220px to the right and 220px below the initial box and sets the color to orange.

Final Logo

If you view yourindex.html file in a browser you should see the completed Microsoft Logo:

completed microsoft logo

Let's Connect

Thanks for reading my article today. You can get thesource code here.

If you like my content, please considerbuying me a coffee ☕.

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
ryan284057 profile image
AlyceRyan21
  • Joined

Creating the Microsoft Logo is a fantastic endeavor that showcases innovation and design prowess. The seamless fusion of elements highlights the brand's evolution. The use ofglass shades for pendant lights in the logo's vibrant colors adds a captivating dimension, symbolizing clarity and forward-thinking. This artistic masterpiece not only represents a company but also embodies a vision, making it a true inspiration for aspiring designers and creators everywhere.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

I am a Senior Software Engineer. Google Developers Expert. Entrepreneur. Mountain Climber. Neil Diamond fanatic. MBA grad. World traveler.
  • Location
    Atlanta, GA
  • Work
    Senior Software Engineer
  • Joined

More fromJennifer Bland

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp