Get Screen Resolution | Screen Size using HTML & JavaScript

Namaste!

Introduction

Today, we created a tool “Get Screen Resolution | Screen size with html & Javascript “. Then done some work with css.

we created it simply and desogned as a web tool.

Get Screen Resolution | Screen Size YouTube Tutorial

Get Screen Resolution | Screen Size using HTML & JavaScript

Screen Resolution | Screen Size Tool Source Code Download

Create a blank .html file then

Put below code inside your <body> Your Code Here </body> tag.

.html file code

<div class="container">
        <p>Your Screen Resolution</p>
        <div id="resolution"></div>
    </div>

Now, Put below code inside <style> Your Code Here </style> or inside .css file

.css file code

body{
    background-color: #3378ff;
}
.container{
    width: 350px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
p{
    color: rgb(233, 233, 233);
    font-size: 18px;
    font-weight: 600;
}
#resolution{
    position: relative;
    width: 300px;
    color: #3378ff;
    background-color: #fff;
    left: 20px;
    font-weight: 600;
    font-size: 35px;
    padding: 25px 0;
    border-radius: 8px;
    box-shadow: 0 20px 30px rgba(11, 14, 56, 0.151);
}

Now, the main code for this tool is Javascript

put this code inside your script file

.js file code

let resolution = document.getElementById("resolution");
resolution.textContent = `${window.screen.width} x ${window.screen.height}`;

Thank You!

Share your love
Default image
Neeraj Lamba
Articles: 38

Leave a Reply

Your email address will not be published.

I'm not a robot *Captcha loading...

5 Movies that Programmers Should Watch Best Search Engine for Developers – You.com 06 Free Website Hosting Providers for Developers You should Know Learn Programming while playing games learn about Operating systems and OS Structure Design
Secured By miniOrange