Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.
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
65 changes: 65 additions & 0 deletions Form-Controls/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# HTML/ CSS Week 3

## Forms, styling forms, and Devtools

## Aims

- Interpret requirements
- Write a valid form
- Style form controls
- Test with Devtools
- Refactor using Devtools

## Task

We are selling t-shirts. Write a form to collect the following data:

Our customers already have accounts, so we know their addresses and charging details already. We don't need to collect that data. We want to confirm they are the right person, then get them to choose a colour and then pick a delivery date.

Writing that out as a series of questions to ask yourself:

1. What is the customer's name? I must collect this data, and validate it. But what is a valid name? I must decide something.
2. What is the customer's email? I must make sure the email is valid. Email addresses have a consistent pattern.
3. What colour should this t-shirt be? I must give three options. How will I make sure they don't pick other colours?
4. When do they want the t-shirt to be delivered? I must collect a date and make sure that date is in the next four weeks. How will I do this? How will I make sure there are no mistakes about the date?

All fields are required.
Do not write a form action for this project.

## Developers must test their work.

Let's write out our testable criteria:

- [ ] I have used HTML and CSS only.

### HTML

- [ ] My form is semantic html.
- [ ] My Lighthouse Accessibility score is 100.
- [ ] All inputs have associated labels.
- [ ] I require a valid name. I have defined a valid name as a text string of two characters or more.
- [ ] I require a valid email.
- [ ] I require one colour from a defined set of three colours.
- [ ] I require one date from a constrained date range.

### CSS

- [ ] My form is usable at phone and desktop screen sizes.
- [ ] I show which element is focused.
- [ ] My Lighthouse Accessibility score is 100.

## Extension Task

If you have done all these things and you would like a really big challenge, run a further test and refactor your code.

- In Chrome Devtools, open the Command Palette
https://developer.chrome.com/docs/devtools/command-menu/
- Type 'coverage' and open the Coverage drawer
https://developer.chrome.com/docs/devtools/coverage/
- Refactor your code until you have no unused CSS, or as close to that as you can get. Prettier will prevent you minifying your code so the last few bytes are out of your reach, sorry!
- This challenge isn't about writing less CSS, it's about writing less _pointless_ CSS, so don't remove code that is actually being used in your layout.
- Insider tip: you might have to select some elements so their focus states don't get miscounted as unused. You can force state in Devtools:
https://twitter.com/ChromeDevTools/status/986992837127319552
- Take a screenshot of your coverage stats.

Sanity check: this extension is tough! Try it in your own time and don't let it hold up your coursework submission.
71 changes: 71 additions & 0 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>My form exercise</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,400;0,700;1,400&display=swap"
rel="stylesheet">
</head>
<body>
<header>
<h1>Product Pick</h1>
</header>
<main>
<form>


<legend>T-Shirt Order</legend>

<div class="personal-details">
<label for="Fname">First Name</label>
<input type="text" id="Fname" name="Fname" placeholder="First Name" pattern="[A-Za-z]{3,15}" required>

<label for="Sname">Surname</label>
<input type="text" id="Sname" name="Sname" placeholder="Surname" pattern="[A-Za-z]{3,15}" required>

<label for="email">Email Address</label>
<input type="email" id="email" name="email" placeholder="Email adress" required>
</div>


<p>Please pick a t-shirt colour for your order</p>
<div class="colour-top">
<label for="choice-1">Red
<input id="choice-1" type="radio" name="colour" value="red" required>
</label>

<label for="choice-2">Blue
<input id="choice-2" type="radio" name="colour" value="blue">
</label>

<label for="choice-3">Pink
<input id="choice-3" type="radio" name="colour" value="pink">
</label>
</div>


<p>Please pick an order delivery date for in the next four weeks</p>
<div class="dates-delivery">
<label for="date">Delivery dates</label>
<input type="date" id="date" name="delivery-date" value="2020-06-14" min="2021-06-21" max="2021-07-12" required>
</div>

<div class="submit-btn">
<input type="Submit">
</div>

</form>

</main>
<footer>
<!-- change to your name-->
<h2><a rel="website" href="https://github.com/Sharm-Dev" target="_blank">Sharm-Dev on Github</a></h2>
</footer>
</body>

</html>
150 changes: 150 additions & 0 deletions Form-Controls/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
body {
background-color: #387780;
font-family: 'Roboto', sans-serif;
}

form {
background-color: #DBD4D3;
padding: 12px;
margin-top: 4rem;
}

legend {
text-align: center;
font-size: 20px;
margin-top: 2rem;
}

h1, h2 {
display: flex;
justify-content: center;
color: #ffffff;
font-size: 40px;
margin-top: 4rem;
}
h2 a {
text-decoration: none;
color: #ffffff;
}
.personal-details {
margin-top: 50px;
}
.personal-details label {
font-size: 18px;
}

label {
display: flex;
margin: 10px 0;
}

input[type=text], [type=email], [type=date] {
width: 80%;
padding: 5px;
margin-bottom: 15px;
border: 1px solid rgb(64, 66, 67);
border-radius: 15px;
font-size: 18px;
}
input:focus {
background: #aadce4;

}

p {
text-align: center;
margin: 60px 30px 20px 30px;
font-size: 20px;
}

.colour-top {
display: flex;
justify-content: center;
font-size: 20px;
}

.colour-top label {
margin:0 20px;
}


.dates-delivery {
display: flex;
flex-direction: column;
}
.dates-delivery label {
font-size: 18px;
}
.dates-delivery input {
font-size: px;
}

.submit-btn {
display: flex;
justify-content: center;
}

.submit-btn input {
border: none;
padding: 15px;
border-radius: 20px;
background-color: #030591;
color: #fff;
font-size: 18px;
font-weight: bold;
margin-bottom: 20px;
letter-spacing: 3px;
}

.submit-btn input:hover {
background-color: #387780;
}

@media screen and (min-width: 600px) {
form {
width: 500px;
margin-left: auto;
margin-right: auto;
}
legend {
font-size: 30px;
}
h1, h2 {
font-size: 45px;
}
.personal-details label {
font-size: 25px;
}
p {
margin: 60px 30px 20px 30px;
font-size: 25px;
}
.colour-top {
display: flex;
justify-content: center;
font-size: 25px;
}
.dates-delivery label {
font-size: 25px;
}
.submit-btn input {
font-size: 20px;
}
}
@media screen and (min-width: 1000px) {
form {
width: 600px;
height: 860px;
margin-left: auto;
margin-right: auto;
}
legend {
font-size: 40px;
}
input[type=text], [type=email], [type=date] {
font-size: 20px;
}
}



42 changes: 42 additions & 0 deletions Two-Truths-One-Lie/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# HTML-CSS-W2-InClassProject

## Aim

- use CSS grid
- use CSS flexbox
- test your code

##

- Work in pairs.
- Write two truths and a lie each.
- Mark up your content with semantic HTML
- Lay out your page using flexbox and grid
- Test your work with Devtools.
- You can get pictures and choose custom size in the download at https://www.pexels.com/
- If you want to use a different font, get them from https://fonts.google.com/
- You can change the colours if you like

## Testing your work

Developers must test their work. Here are the tests for your project. Read your tests before you start coding.

### CSS tests

- [ ] we have used grid
- [ ] we have used flexbox
- [ ] we have used at least one media query

### HTML tests

- [ ] our names are at the bottom
- [ ] we have written semantic HTML
- [ ] we have looked in the Accessibility tree
- [ ] our Lighthouse Access score is 100

### Design tests

- [ ] our layout works on desktop and mobile
- [ ] our cards are side by side on large screens and stacked on smaller screens
- [ ] we have taken a screenshot at laptop and Moto G4 device sizes using Devtools
- [ ] when we size the text up by 200%, our layout does not break
Loading