Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6998887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:28:08+00:00 2026-05-27T20:28:08+00:00

I have made a simple table form here in jsfiddle . I also put

  • 0

I have made a simple table form here in jsfiddle.

I also put my code here:

<table>
     <tr>
        <td class="field_label">name</td>
        <td>*</td>
        <td>
         <input type="text">
        </td>
        <td>
         <input type="text">
        </td>

      </tr>

      <tr>
        <td>email</td>
        <td>*</td>
        <td colspan="2">
           <input type="text"> 
        </td>
      </tr>
</table>

Two questions:

1. As you see, I use colspan="2" in email input field <td> to make the text field length the same as name fields which occupy two columns, but it does not work, why?

2. How can I set default value in the input field and set default value color to be gray ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:28:09+00:00Added an answer on May 27, 2026 at 8:28 pm

    Regarding question 1.: The column holding the input for the second table row will be 2 columns long (as you could see if you were showing borders for the table columns); however, input fields have a default width in every browser – meaning that the input will show at exactly the same width as the one input above; that’s why you probably think colspan isn’t working.

    Add a size attribute to the input tag, or a width css property, e.g. like this:

    <table>
     <tr>
        <td class="field_label">name</td>
        <td>*</td>
        <td><input type="text"></td>
        <td><input type="text"></td>
      </tr><tr>
        <td>email</td>
        <td>*</td>
        <td colspan="2"><input type="text" style="width:99%;" ></td>
      </tr>
    </table>
    

    As for 2., the default value of an input can be set by using the value attribute:

    <input type="text" name="ID" value="101" />
    

    As shown in the example, you should also use at least the name attribute (to be able to reference the input from JavaScript or PHP); and to make it html5 valid, you should close the tag with /> (since you don’t have a separate closing </input> tag).

    Changing the text color can be done by adding CSS styles; either in the input itself, or via the id or class attributes; the following would e.g. make the text color in the input light gray:

    <input type="text" style="color:#CCC;" >
    

    Be sure to check out how to specify CSS styles in general (e.g. inline, or by id or class), and how to specify colors with CSS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a simple form like so (illustrative purposes only)... <form> <div class=input-row> <label>Name</label>
I have made my own file type (.ddd) and I made a simple program
I have started using jQuery and rails. I have made a simple form that
I have a simple nav made up of the following HTML; <div class=inner> <div
I have a simple table made up of two columns: col_A and col_B .
I have an ASP.NET MVC3 app that features a form with a nested-table input
I have made a simple test application for the issue, two winforms each containing
I'm just playing around with WPF and MVVM, and I have made a simple
I have made a very simple AppleScript to close tabs in Safari. The problem
in my application I made a very simple binding. I have a NSMutableArray bound

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.