Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increase font size in input field

I have a large input field and I can't figure out how to make the text larger without making the input field even bigger. When I set the font size to 2em, for example, the input field grows to take up the whole page. Tried fixing it with line-height and that didn't work. Any suggestions? Thanks. I included a pic of the current size, and I'd like the text to fill the field.

current situation enter image description here

HTML:

<table class="contact-table">
            <tr id="test">
                <td id="contact-image">
                    <img id="library" src="library.jpeg"/>
                </td>
                <td id="contact-form">
                    <div class="label-wrapper">
                        <label for="name">Name</label>
                        <input id="name" type="text" name="name" class="top-input">
                    </div>
                    <div class="label-wrapper">
                        <label for="email">Email Address</label>
                        <input id="email" type="text" name="email" class="top-input">
                    </div>
                    <div class="label-wrapper">
                        <label for="message">Message</label>
                        <textarea id="message" type="text" name="message"></textarea>
                    </div>
                </td>
            </tr>
        </table>

CSS:

.contact-table {
    width: 100%;
}

#contact-form {
    width: 50%;
    padding-right: 8%;
}

.label-wrapper {
    text-align: center;
    display: inline-block;
    font-size: 2em;
}

.top-input {
    width: 30em;
    height: 4em;
    border-radius: 5px;
    display: inline-block;
    border: white;
    line-height: inherit;
    font-size:
}

#message {
    width: 61em;
    height: 30em;
    border-radius: 5px;
    border: white;
}
like image 728
George Wright Avatar asked Sep 11 '25 10:09

George Wright


1 Answers

You can do this by using rem (or another method, like pixel size) to dictate the height of the input field. For example, this snippet sets the input text size to 2em but keeps the input box "normal size" by setting the height to 1rem.

body {
  font-size: 1em;
}

#inputField {
  font-size: 2em;
  height: 1rem;
}
<p>Normal Text</p>
<input id="inputField" />
like image 92
freginold Avatar answered Sep 14 '25 00:09

freginold