-
Hajipur, Bihar, 844101
CSS User Interface (UI) refers to a set of CSS properties that control how elements behave visually in response to user interaction. These include cursor behavior, element resizing, text selection, and how elements are focused.
UI properties improve user experience by making websites more interactive and user-friendly.
Property | Description |
---|---|
cursor |
Changes the mouse cursor when hovering over an element |
resize |
Allows elements (like textareas) to be resizable |
outline |
A line drawn around an element (often for focus) |
box-sizing |
Controls box model calculation |
user-select |
Enables or disables text selection |
pointer-events |
Enables or disables mouse interactions |
caret-color |
Changes the color of the text input cursor |
button {
cursor: pointer;
}
Available values: default
, pointer
, wait
, move
, text
, crosshair
, not-allowed
, etc.
textarea {
resize: both; /* horizontal, vertical, none, both */
}
p {
user-select: none; /* disables text selection */
}
button.disabled {
pointer-events: none; /* disables click */
opacity: 0.5;
}
input {
caret-color: red;
}
✅ Write CSS for the following:
Q1. Change the cursor to a hand icon on a clickable element.
Q2. Disable text selection for a paragraph.
Q3. Make a <textarea>
resizable only vertically.
Q4. Hide the default focus outline on buttons.
Q5. Change the caret color in an input field.
Q6. Apply box-sizing: border-box
to all elements.
Q7. Prevent clicks on a disabled button using pointer-events
.
Q8. Make an image unselectable using user-select
.
Q9. Add a custom move
cursor for draggable items.
Q10. Highlight focused input fields with a green outline.
Q1: Which property changes the mouse pointer appearance?
Q2: Which value disables resizing of a <textarea>?
Q3: Which property disables text selection?
Q4: Which CSS property removes all mouse events from an element?
Q5: What is the default value of box-sizing?
Q6: How do you show a wait icon when hovering over a button?
Q7: Which property changes the color of the text cursor in input?
Q8: How to allow vertical resize only in a textarea?
Q9: How do you apply the same box-sizing to all elements?
Q10: What happens if pointer-events: none; is set?