Skip to content

Complete the css-exercises #692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Ignore MacOS autogenerated
.DS_Store
.vscode/
10 changes: 5 additions & 5 deletions foundations/block-and-inline/01-margin-and-padding-1/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ body {
background: pink;
border: 3px solid blue;
/* CHANGE ME */
padding: 0px;
margin: 0px;
padding: 32px;
margin: 12px;
}

.two {
background: lightblue;
border: 3px solid purple;
/* CHANGE ME */
margin-bottom: 0px;
margin-bottom: 48px;
}

.three {
background: peachpuff;
border: 3px solid brown;
width: 200px;
/* CHANGE ME */
padding: 0px;
margin-left: 0px;
padding: 32px;
margin-left: 300px;
}
11 changes: 11 additions & 0 deletions foundations/block-and-inline/02-margin-and-padding-2/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,32 @@ body {
width: 400px;
background: #fff;
margin: 16px auto;
padding: 8px;
}

.title {
background: #e3f4ff;
font-size: 16px;
margin-bottom: 8px;
padding: 8px;
}

.content {
background: #e3f4ff;
padding: 16px 8px;
margin-bottom: 8px ;
}

.button-container {
background: #e3f4ff;
text-align: center;
padding: 8px;
}

button {
background: white;
border: 1px solid #eee;
display: block;
margin: 0 auto;
padding: 8px 24px;
}
34 changes: 21 additions & 13 deletions foundations/cascade/01-cascade-fix/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@ body {
font-family: Arial, Helvetica, sans-serif;
}

.para,
.small-para {
color: hsl(0, 0%, 0%);
font-weight: 800;
.para {
font-size: 22px;
}

.small-para {
font-size: 14px;
font-weight: 800;
}

.para {
font-size: 22px;
.para,
.small-para {
color: hsl(0, 0%, 0%);
font-weight: 800;
}

.confirm {
/*
I used an ID selector to target the Confirm button as .confirm wasn't working
*/

#confirm-button {
background: green;
color: white;
font-weight: bold;
Expand All @@ -29,14 +33,18 @@ body {
font-size: 20px;
}

.child {
color: rgb(0, 0, 0);
font-weight: 800;
font-size: 14px;
}

div.text {
color: rgb(0, 0, 0);
font-size: 22px;
font-weight: 100;
}

/*
I combined the type and class to target the div with a class child
*/

div.child {
color: rgb(0, 0, 0);
font-weight: 800;
font-size: 14px;
}
3 changes: 3 additions & 0 deletions foundations/flex/01-flex-center/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
border: 4px solid midnightblue;
width: 400px;
height: 300px;
display: flex;
align-items: center;
justify-content: center;
}

.box {
Expand Down
8 changes: 8 additions & 0 deletions foundations/flex/02-flex-header/style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
.header {
font-family: monospace;
background: papayawhip;
padding: 9px;
display: flex;
align-items: center;
justify-content: space-between;
}

.logo {
Expand All @@ -14,6 +18,10 @@
ul {
/* this removes the dots on the list items*/
list-style-type: none;
display: flex;
gap: 9px;
margin: 0;
padding: 0;
}

a {
Expand Down
28 changes: 18 additions & 10 deletions foundations/flex/03-flex-header-2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,26 @@
</head>
<body>
<div class="header">
<div class="logo">
LOGO
<!-- .left-items is a container for both the logo and the links -->
<div class="left-items">
<div class="logo">
LOGO
</div>
<div>
<ul class="links">
<li><a href="https://google.com">link-one</a></li>
<li><a href="https://google.com">link-two</a></li>
<li><a href="https://google.com">link-three</a></li>
</ul>
</div>
</div>
<ul class="links">
<li><a href="https://google.com">link-one</a></li>
<li><a href="https://google.com">link-two</a></li>
<li><a href="https://google.com">link-three</a></li>
</ul>
<button class="notifications">
<!-- .right-items is a container for both the button and the .profile-image -->
<div class="right-items">
<button class="notifications">
1 new notification
</button>
<div class="profile-image"></div>
</button>
<div class="profile-image"></div>
</div>
</div>
</body>
</html>
20 changes: 20 additions & 0 deletions foundations/flex/03-flex-header-2/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ body {
background: white;
border-bottom: 1px solid #ddd;
box-shadow: 0 0 8px rgba(0,0,0,.1);
display: flex;
align-items: center;
justify-content: space-between;
/* This inserts a space between the items and the header */
padding: 8px;
}

/*
This centers the logo and links on the right and the button and profile-image on the left
*/

.right-items,
.left-items {
display: flex;
align-items: center;
gap: 16px;
}

.profile-image {
Expand Down Expand Up @@ -45,4 +61,8 @@ a {

ul {
list-style-type: none;
display: flex;
margin: 0;
padding: 0;
gap: 10px;
}
31 changes: 18 additions & 13 deletions foundations/flex/04-flex-information/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@
</head>
<body>
<div class="title">Information!</div>

<img src="./images/barberry.png" alt="barberry">
<div class="text">This is a type of plant. We love this one.</div>

<img src="./images/chilli.png" alt="chili">
<div class="text">This is another type of plant. Isn't it nice?</div>

<img src="./images/pepper.png" alt="pepper">
<div class="text">We have so many plants. Yay plants.</div>

<img src="./images/saffron.png" alt="saffron">
<div class="text">I'm running out of things to say about plants.</div>

<div class="container">
<div class="frame">
<img src="./images/barberry.png" alt="barberry">
<div class="text">This is a type of plant. We love this one.</div>
</div>
<div class="frame">
<img src="./images/chilli.png" alt="chili">
<div class="text">This is another type of plant. Isn't it nice?</div>
</div>
<div class="frame">
<img src="./images/pepper.png" alt="pepper">
<div class="text">We have so many plants. Yay plants.</div>
</div>
<div class="frame">
<img src="./images/saffron.png" alt="saffron">
<div class="text">I'm running out of things to say about plants.</div>
</div>
</div>
<!-- disregard this section, it's here to give attribution to the creator of these icons -->
<div class="footer">
<div>Icons made by <a href="https://www.flaticon.com/authors/icongeek26" title="Icongeek26">Icongeek26</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>
Expand Down
12 changes: 12 additions & 0 deletions foundations/flex/04-flex-information/style.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
body {
font-family: 'Courier New', Courier, monospace;
text-align: center;
}

.container {
display: flex;
justify-content: center;
gap: 52px;
margin-top: 32px;
}

img {
width: 100px;
height: 100px;
}

.frame {
max-width: 200px;
}

.title {
font-size: 36px;
font-weight: 900;
Expand Down
18 changes: 11 additions & 7 deletions foundations/flex/05-flex-modal/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
<title>Modal</title>
</head>
<body>
<div class="modal">
<div class="icon">!</div>
<div class="header">Are you sure you want to do that?</div>
<button class="close-button">✖</button>
<div class="text">Lorem ipsum dolor sit amet consectetur adipisicing elit. Pariatur excepturi id soluta, numquam minima rerum doloremque eveniet aspernatur beatae commodi. Cupiditate recusandae ad repellendus quidem consectetur sequi amet aspernatur cumque!</div>
<button class="continue">Continue</button>
<button class="cancel">Cancel</button>
<div class="modal"> <!-- main flex container -->
<div class="icon">!</div>
<div class="container"> <!-- flex container to align the contents vertically (header, close button, text, and the close and continue btns) -->
<div class="header">Are you sure you want to do that?<button class="close-button">✖</button>
</div>
<div class="text">Lorem ipsum dolor sit amet consectetur adipisicing elit. Pariatur excepturi id soluta, numquam minima rerum doloremque eveniet aspernatur beatae commodi. Cupiditate recusandae ad repellendus quidem consectetur sequi amet aspernatur cumque!</div>
<div class="btn-container"> <!-- flex container to align the buttons -->
<button class="continue">Continue</button>
<button class="cancel">Cancel</button>
</div>
</div>
</div>
</body>
</html>
26 changes: 25 additions & 1 deletion foundations/flex/05-flex-modal/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,29 @@ body {
justify-content: center;
}

div .header {
display: flex;
justify-content: space-between;
font-weight: bold;
font-size: 18px;
}
/* flex container for the header, close button and the main text */
.container {
display: flex;
flex-direction: column;
justify-content: center;
flex: 1; /* Flex 1 on the container makes the container grow to take rest of the space */
gap: 10px;
}

.modal {
background: white;
width: 480px;
border-radius: 10px;
box-shadow: 2px 4px 16px rgba(0,0,0,.2);
padding: 15px; /* Add flexbox to the modal container to align icon next to the content */
display: flex; /* Space between layout */
gap: 15px;
}

.icon {
Expand All @@ -32,7 +50,8 @@ body {
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
justify-content: center; /* Prevents icon from shrinking */
flex-shrink: 0;
}

.close-button {
Expand All @@ -49,6 +68,11 @@ body {
border: 1px solid #eee;
padding: 0;
}
/* container for the continue and cancel buttons */
.btn-container {
display: flex; /* makes the container a flexbox and aligns the buttons horizontally as the default flex direction is row */
gap: 10px;
}

button {
cursor: pointer;
Expand Down
Loading