So in the webpage that I'm making, in the "Contact" section you have a form. In the message input, the placeholder is positioned center left instead of top left (when you start writing your message it also starts at the center left position). How can I resolve this?
CodeSandbox link: Link
instead of using an input
<input
type="text"
placeholder="Message*"
name="message"
className="input-message"
value={user.message}
onChange={(e) => handleChange(e.target.value, "message")}
/>
Use a textarea element
<textarea
placeholder="Message*"
name="message"
className="input-message"
value={user.message}
onChange={(e) => handleChange(e.target.value, "message")}
></textarea>
Instead of height
for input you can use padding
, or change input
with textarea
and add some css
styles on it as well
try it with css:
textarea{
vertical-align: top;
}
Change
<input
type="text"
type="text"
placeholder="Message*"
name="message"
className="input-message"
value={user.message}
onChange={(e) => handleChange(e.target.value, "message")}
/>
with
<textarea
type="textarea"
placeholder="Message*"
name="message"
className="input-message"
value={user.message}
onChange={(e) => handleChange(e.target.value, "message")}
/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.