Skip to main content
Date :

Create Contact Form

 

Create a Contact Section

Step 1) Add HTML:

Example

<div class="container">
  <div style="text-align:center">
    <h2>Contact Us</h2>
    <p>Swing by for a cup of coffee, or leave us a message:</p>
  </div>
  <div class="row">
    <div class="column">
      <img src="/w3images/map.jpg" style="width:100%">
    </div>
    <div class="column">
      <form action="/action_page.php">
        <label for="fname">First Name</label>
        <input type="text" id="fname" name="firstname" placeholder="Your name..">
        <label for="lname">Last Name</label>
        <input type="text" id="lname" name="lastname" placeholder="Your last name..">
        <label for="country">Country</label>
        <select id="country" name="country">
          <option value="australia">Australia</option>
          <option value="canada">Canada</option>
          <option value="usa">USA</option>
        </select>
        <label for="subject">Subject</label>
        <textarea id="subject" name="subject" placeholder="Write something.." style="height:170px"></textarea>
        <input type="submit" value="Submit">
      </form>
    </div>
  </div>
</div>


Step 2) Add CSS:

Example

{
  box-sizing: border-box;
}

/* Style inputs */
input[type=text], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  margin-top: 6px;
  margin-bottom: 16px;
  resize: vertical;
}

input[type=submit] {
  background-color: #04AA6D;
  color: white;
  padding: 12px 20px;
  border: none;
  cursor: pointer;
}

input[type=submit]:hover {
  background-color: #45a049;
}

/* Style the container/contact section */
.container {
  border-radius: 5px;
  background-color: #f2f2f2;
  padding: 10px;
}

/* Create two columns that float next to eachother */
.column {
  float: left;
  width: 50%;
  margin-top: 6px;
  padding: 20px;
}

/* Clear floats after the columns */
.row:after {
  content: "";
  display: table;
  clear: both;
}

/* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
  .column, input[type=submit] {
    width: 100%;
    margin-top: 0;
  
}
}

Comments

Popular posts from this blog

Create a Header

Header Header My supercool header Create a Header Step 1) Add HTML: Example < div  class ="header" >    < h1 > Header < /h1 >    < p > My supercool header < /p > < /div Step 2) Add CSS: Style the header with a large padding, centered text, a specific background-color and a big sized text: Example .header  {   padding :  60px ;   text-align :  center ;   background :  #1abc9c ;   color :  white ;   font-size :  30px ; }

View PC localhost on your mobile phone

Very Simple Method to see your localhost on your mobile phone.  Serve over your wifi via local IP This sounds complicated but its actually really easy. IMPORTANT: Make sure that your dev computer and your mobile device are connected to the same wifi network. Step 1: Serve to Localhost On your dev machine, serve your application in whatever way you usually do that serves it over a  localhost  address. Make sure to note what port number its being served on. In the image below, we’re noting  8080 . Once you are able to view your app locally on your computer via localhost, you can move to step 2. Step 2: Find your Local IP Address Open  System Preferences  >  Network . Select “Wifi” in the left pane if it isn’t already selected. Under “Status: Connected”, you should see “Wi-Fi is connected to <network name> and has the IP address < local IP address >.” Take note of that IP address! Note: It’s common for your Local IP Address to change automa...

Code for Digital clock

Click here to see Digital Clock <!DOCTYPE html> <html> <head>   <title>Digital Clock</title> //Add following CSS    <style>     body {       font-family: sans-serif;     }     .clock {       position: absolute;       top: 50%;       left: 50%;       transform: translate(-50%, -50%);       font-size: 60px;       color: black;     }   </style> </head>