Skip to main content

How to Create Solar System Using HTML & CSS

 

#solar #system #panel #blog #html #css #foryou #world #happy # website #webdesign #webdeveloper #how to #howto #trending #viral #srilanka #youtube #tiktok #blog  #howtocreate #Javascript #image #imageuploader

🌟 Explore the Universe: Building a Solar System with HTML and CSS! 🌟 Welcome to another mind-blowing adventure on @Coding With Nexus ! 🚀 Join us as we embark on an interstellar journey to create our very own solar system using nothing but HTML and CSS. 🌌

First Create a New Folder, Then

1.Open the folder in Vs Code
2.Create index.html and style.css Files
3.Begin Coding 

index.html


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Solar System</title>
</head>
<body>
    <div class="container">
        <div class="sun"></div>
        <div class="earth">
            <div class="moon"></div>
        </div>
    </div>
</body>
</html>



style.css

body{
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #070e17;
    overflow: hidden;
}
.container{
    font-size: 10px;
    width: 40em;
    height: 40em;
    position: relative;
}
.sun{
    position: absolute;
    top: 15em;
    left: 15em;
    width: 10em;
    height: 10em;
    border-radius: 50%;
    box-shadow: 0 0 3em white;
}
.earth , .moon{
    position: absolute;
    border-style: solid;
    border-color: white transparent transparent transparent;
    border-radius: 0.1em 0.1em 0;
    border-radius: 50%;

}
.earth{
    top: 5em;
    left: 5em;
    width:30em ;
    height: 30em;
    animation: orbit 36.5s linear infinite;
}
.moon{
    top: 0;
    right: 0;
    width: 8em;
    height: 8em;
    animation:  orbit 2.7s linear infinite;

}
.earth::before, .moon::before{
    content: '';
    position: absolute;
    border-radius: 50%;
}
.earth::before{
    top:2.8em ;
    right:2.8em;
    width: 3em;
    height: 3em;
    background-color: #34A56f;

}
.moon::before{
    top: 0.8em;
    right: 0.2em;
    width: 1.2em;
    height: 1.2em;
    background-color:#88aea3 ;
}
@keyframes orbit{
    to{
        transform:rotate(360deg) ;
    }
}

Comments

Popular posts from this blog

Parallax Scrolling Website Effect Using HTML CSS

  Welcome to our step-by-step tutorial on creating Parallax Scrolling Website Effect using #html  & #css  . In this video, we'll guide you through the process of building a simple yet effective Parallax Effect for your web projects. With just a few lines of code, you'll learn how to create a user-friendly interface that allows users to this effect seamlessly. Whether you're a beginner or an experienced developer looking to enhance your skills, this tutorial is perfect for you. Follow along and empower yourself to create dynamic web applications with ease! Don't forget to like, share, and subscribe for more coding tutorials. Let's get started! index.html  <! DOCTYPE html > < html lang = "en" >   < head >     < meta charset = "UTF-8" />     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" />     < title > Parallax Scrolling Website </ title >     ...

Create an Animated Switch with HTML and CSS in 2024

  Create an Animated Switch with HTML and CSS in 2024 Learn how to create an animated switch using HTML and CSS in 2024! This tutorial will guide you through the process of building a sleek and modern switch element for your website. Enhance your web development skills and stay up-to-date with the latest design trends by mastering this technique. Watch now to level up your front-end development game!  index.html  <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < title > Document </ title >     < link rel = "stylesheet" href = "style.css" > </ head > < body >     < label class = "switch" >         < input type = "checkbox" checked = "checked" >         < div class = "button" >  ...

Animated Switch

    index.html <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < title > Document </ title >     < link rel = "stylesheet" href = "style.css" > </ head > < body >     < label class = "switch" >         < input class = "cb" type = "checkbox" />         < span class = "toggle" >           < span class = "left" > off </ span >           < span class = "right" > on </ span >         </ span >       </ label >       </ body > </ html > style.css  /* The switch - the box around the slider */ .switch {     font-size : 17px ; ...