Skip to main content

Style Textarea

A small "grabber" in the bottom right corner lets users resize a <textarea> by dragging it, which is the default behavior. Setting the resize property to none removes it.

Example

Prompt
Create an HTML page with a styled textarea. The textarea should be 100% wide, 150px tall, have 12px 20px padding, border-box sizing, a 2px solid #ccc border, 4px border-radius, #f8f8f8 background, and resize set to none.
Output: complete HTML page

Style a Dropdown Menu

Example

Prompt
Create an HTML page with a styled dropdown select menu containing options for Australia, Canada, and USA. The select element should be 100% wide, have 16px 20px padding, no border, 4px border-radius, and a #f1f1f1 background color.
Output: complete HTML page

Style Form Buttons

CSS can style form buttons as well, whether their type is "button", "submit", or "reset".

Tip: The CSS Buttons Tutorial goes into more detail on styling buttons.

Example

Prompt
Create an HTML page with three styled form buttons: Submit (type submit), Reset (type reset), and Button (type button). Style all three with a green (#04AA6D) background, no border, white text, 16px 32px padding, no text decoration, 4px 2px margin, and pointer cursor.
Output: complete HTML page

CSS Responsive Form

A form becomes responsive through CSS media queries. Below a screen width of 600px, labels and input fields no longer sit next to each other and instead stack vertically.

Example

Change the screen size and watch the form layout respond.

Prompt
Create an HTML page with a responsive form that has first name, last name, and country fields with labels beside inputs. Use a media query so that when the screen is less than 600px wide, the labels and inputs stack vertically instead of appearing side by side.
Output: complete HTML page