Skip to content

Commit

Permalink
mobile responsiveness
Browse files Browse the repository at this point in the history
  • Loading branch information
zaidm124 committed Oct 4, 2021
1 parent 5096378 commit 686b44b
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 84 deletions.
66 changes: 35 additions & 31 deletions 03 - Random Color Generator/index.html
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
<!DOCTYPE html>
<html lang = "en">
<head>
<meta charset = "UTF-8">
<meta http-equiv = "X-UA-Compatible" content = "IE=edge">
<meta name = "viewport" content = "width=device-width, initial-scale=1.0">
<title>Random Color Generator</title>
<link rel = "stylesheet" href = "style.css">
<link rel = "shortcut icon" href = "assets/wheel.png" type = "image/x-icon">
</head>
<body>
<h2 class = "heading">
Random Color Generator
</h2>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Random Color Generator</title>
<link rel="stylesheet" href="style.css" />
<link rel="shortcut icon" href="assets/wheel.png" type="image/x-icon" />
</head>
<body>
<h2 class="heading">Random Color Generator</h2>

<div class = "item">
<button class = "btn" onclick = "addColor();">
Refresh
</button>
<div class = "copy">Click on a box to copy the hashcode to clipboard</div>
</div>
<section class = "container"></section>
<br><br>
<footer>
<p>&#x3c; &#47; &#x3e; with ❤️ by
<a href = "https://swapnilsparsh.github.io/">Swapnil Srivastava</a>
<br>
<a href = "https://github.com/swapnilsparsh/30DaysOfJavaScript" target = "_blank">#30DaysOfJavaScript
</a>
</p>
</footer>
<div class="body">
<div class="item">
<button class="btn" onclick="addColor();">Refresh</button>
<div class="copy">Click on a box to copy the hashcode to clipboard</div>
</div>
<div class="cont">
<section class="container"></section>
</div>
</div>
<br /><br />
<footer>
<p>
&#x3c; &#47; &#x3e; with ❤️ by
<a href="https://swapnilsparsh.github.io/">Swapnil Srivastava</a>
<br />
<a
href="https://github.com/swapnilsparsh/30DaysOfJavaScript"
target="_blank"
>#30DaysOfJavaScript
</a>
</p>
</footer>

<script src = "main.js"></script>
</body>
<script src="main.js"></script>
</body>
</html>
146 changes: 93 additions & 53 deletions 03 - Random Color Generator/style.css
Original file line number Diff line number Diff line change
@@ -1,92 +1,132 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: "sans";
color: black;
background-color: #19172e;
font-family: "sans";
color: black;
background-color: #19172e;
}

@font-face {
src: url("font/sans.ttf");
font-family: "sans";
src: url("font/sans.ttf");
font-family: "sans";
}

.heading {
color: white;
padding-top: 10px;
justify-content: center;
text-align: center;
font-size: 2rem;
color: white;
padding-top: 10px;
justify-content: center;
text-align: center;
font-size: 2rem;
}

.btn {
background: #333;
color: white;
padding: 15px 60px;
font-size: 1.5rem;
margin: 20px auto;
display: block;
cursor: pointer;
border-radius: 5px;
border: none;
background: #333;
color: white;
padding: 15px 60px;
font-size: 1.5rem;
margin: 20px auto;
display: block;
cursor: pointer;
border-radius: 5px;
border: none;
}

.btn:hover {
background-color: #1e8e3e;
color: white;
background-color: #1e8e3e;
color: white;
}

.container {
display: flex;
flex-wrap: wrap;
display: flex;
flex-wrap: wrap;
}

.box {
width: 33.3%;
height: 150px;
display: flex;
justify-content: center;
align-items: center;
background: #19172e;
border: 2px solid #19172e;
border-radius: 8px;
font-size: 1.5rem;
width: 33.3%;
height: 150px;
display: flex;
justify-content: center;
align-items: center;
background: #19172e;
border: 2px solid #19172e;
border-radius: 8px;
font-size: 1.5rem;
}

footer {
text-align: center;
color: white;
font-size: 1rem;
bottom: 0;
margin-bottom: 0;
padding: 5px;
line-height: 3vh;
text-align: center;
color: white;
font-size: 1rem;
bottom: 0;
margin-bottom: 0;
padding: 5px;
line-height: 3vh;
}

footer a:visited {
color: inherit;
color: inherit;
}

.item {
display: flex;
flex-direction: row;
display: flex;
flex-direction: row;
}

.copy {
color: white;
padding: 15px 60px;
font-size: 1.5rem;
margin: 20px auto;
background: #333;
color: white;
padding: 15px 60px;
font-size: 1.5rem;
margin: 20px auto;
background: #333;
}

.body {
display: flex;
flex-direction: column;
}

@media (max-width: 500px) {
.box {
font-size: 0.8rem;
}
.box {
font-size: 0.8rem;
}
}

@media (max-width: 450px) {
.item {
flex-direction: column;
}
.btn {
width: 100%;
}
.copy {
margin-left: 0px;
width: 100%;
}
}

@media (max-width: 450px) {
.copy {
width: 100%;
}
}

@media (max-width: 840px) {
.copy {
margin-left: 10px;
}
}

@media (max-width: 300px) {
.copy {
padding: 5px;
width: fit-content;
text-align: center;
}
.btn {
padding: 5px;
}
}

0 comments on commit 686b44b

Please sign in to comment.