An open API service indexing awesome lists of open source software.

https://github.com/twinklebyte/contact-form

Contact form created using CSS Grid
https://github.com/twinklebyte/contact-form

Last synced: 6 months ago
JSON representation

Contact form created using CSS Grid

Awesome Lists containing this project

README

          

# Frontend Mentor - Contact form solution

This is a solution to the [Contact form challenge on Frontend Mentor](https://www.frontendmentor.io/challenges/contact-form--G-hYlqKJj). Frontend Mentor challenges help you improve your coding skills by building realistic projects.

## Table of contents

- [Overview](#overview)
- [The challenge](#the-challenge)
- [Screenshot](#screenshot)
- [Links](#links)
- [My process](#my-process)
- [Built with](#built-with)
- [What I learned](#what-i-learned)
- [Author](#author)

**Note: Delete this note and update the table of contents based on what sections you keep.**

## Overview

### The challenge

Users should be able to:

- Complete the form and see a success toast message upon successful submission
- Receive form validation messages if:
- A required field has been missed
- The email address is not formatted correctly
- Complete the form only using their keyboard
- Have inputs, error messages, and the success message announced on their screen reader
- View the optimal layout for the interface depending on their device's screen size
- See hover and focus states for all interactive elements on the page

### Screenshot

![image](https://github.com/TwinkleByte/Contact-form/assets/91601992/99945c1c-ed18-49c8-8f25-68da471d2951)

### Links

- Solution URL: [Solution](https://github.com/TwinkleByte/Contact-form)
- Live Site URL: [Live Site](https://twinklebyte.github.io/Contact-form/)

## My process

### Built with

- Semantic HTML5 markup
- CSS custom properties
- CSS Grid
- Javascript
- Mobile-first workflow

### What I learned
I learned Javascript, text area css element and Input css element.
To see how you can add code snippets, see below:

```html

```
```css
#message-input-id {
font-size: 1rem;
line-height: 25px;
word-spacing: 3px;
width: 656px;
height: 100px;
border: solid 1px var(--t5);
border-radius: 10px;
outline: none;
padding: 14px 12px 4px 24px;
resize: none;
box-sizing: border-box;
transition: all 0.35s;
}
input[type=text] {
border: solid 1px var(--t5);
border-radius: 10px;
outline: none;
padding: 0px 15px 0px 15px;
box-sizing: border-box;
transition: all 0.35s;
}
input[type=text]:hover, input[type=text]:focus {
border: solid 1px var(--button-color);
}
input[type=text]::placeholder {
color: black;
font-size: 20px;
opacity: 1; /* Firefox */
}
```
```js
var checkbox = document.getElementById("check-box");
var checkicon = document.getElementById("check-icon");
const checkedicon = '';
const uncheckedicon = '';

var isChecked = false;

checkbox.onclick = function() {
isChecked = !isChecked;
if (isChecked) {
checkicon.innerHTML = checkedicon;
} else {
checkicon.innerHTML = uncheckedicon;
}
};

const selectedSVG = ``;
const defaultSVG = ``;

document.getElementById('general-enquiry').addEventListener('click', function() {
if (this.classList.contains('selected-option')) {
this.classList.remove('selected-option');
this.querySelector('svg').outerHTML = defaultSVG;
} else {
this.classList.add('selected-option');
this.querySelector('svg').outerHTML = selectedSVG;
document.getElementById('support-request').classList.remove('selected-option');
document.getElementById('support-request').querySelector('svg').outerHTML = defaultSVG;
}
});

document.getElementById('support-request').addEventListener('click', function() {
if (this.classList.contains('selected-option')) {
this.classList.remove('selected-option');
this.querySelector('svg').outerHTML = defaultSVG;
} else {
this.classList.add('selected-option');
this.querySelector('svg').outerHTML = selectedSVG;
document.getElementById('general-enquiry').classList.remove('selected-option');
document.getElementById('general-enquiry').querySelector('svg').outerHTML = defaultSVG;
}
});
```

## Author

- Frontend Mentor - [@TwinkleByte](https://www.frontendmentor.io/profile/TwinkleByte)
- Github - [@TwinkleByte](https://github.com/TwinkleByte)