Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 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
49 changes: 43 additions & 6 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,59 @@
<title>My form exercise</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Product Pick</h1>
</header>
<main>
<form>
<!-- write your html here-->
<!--
try writing out the requirements first as comments
this will also help you fill in your PR message later-->
<div>
<label for="name">Name:</label>
<input type="text" id="name" name="customers_name" required pattern=".*\S.*\S.*">
</div>
<!-- 1. What is the customer's name? I must collect this data and
it contains at least two non-space characters. -->
<div><label for="mail">Email:</label>
<input type ="email" id="mail" name="customers_email" required></div>
<!-- 2. What is the customer's email? I must make sure the email is valid.
Email addresses follow a consistent pattern.-->
<div>
<label for="colour">Colour:</label>

<select id="colour" name="tshirt_colour" required>
<option value="" selected disabled>Choose a colour</option>
<option value="pink">Pink</option>
<option value="yellow">Yellow</option>
<option value="black">Black</option>
</select>
</div>
<!--3. What colour should this T-shirt be? I must provide 3 options.
How will I ensure they do not choose other colours?-->
<div>
<label for="size">Size:</label>

<select id="size" name="tshirt_size" required>
<option value="" selected disabled>Choose a size</option>
<option value="XS">XS</option>
<option value="S">S</option>
<option value="M">M</option>
<option value="L">L</option>
<option value="XL">XL</option>
<option value="XXL">XXL</option>
</select>
</div>
<!-- 4. What size does the customer want? I must provide the following 6 options:
XS, S, M, L, XL, XXL-->
<div class="button">
<button type="submit">Submit</button>
</div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the formatting of the code hard to read. How can you ensure consistent formatting in your code?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I installed the Prettier code formatting extension on VSCode and have now applied this. Hopefully the code is readable now?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks now its nicely formatted. As described in the style guidy: https://curriculum.codeyourfuture.io/guides/reviewing/style-guide/

Indentation helps us to read our code by visually marking how the code is going to run. Programmers rely on this extra information to quickly read and understand code.

You could configure VS code to use prettier to automatically format the code when you save the file. Then you have not to think about it

</form>
</main>
<footer>
<!-- change to your name-->
<p>By HOMEWORK SOLUTION</p>
Talia Kucuk
</footer>
</body>
</html>
55 changes: 55 additions & 0 deletions Form-Controls/style.css

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the styling of the form. It looks nice

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
}

header,
footer {
text-align: center;
padding: 1rem;
}

main {
display: flex;
justify-content: center;
}

form {
background-color: white;
padding: 2rem;
margin-top: 2rem;
width: 320px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

form div {
margin-bottom: 1rem;
}

label {
display: block;
margin-bottom: 0.4rem;
font-weight: bold;
}

input,
select,
button {
width: 100%;
padding: 0.6rem;
box-sizing: border-box;
}

button {
background-color: black;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}

button:hover {
background-color: #333;
}
Loading