Classification and Positioning Properties

PropertyPossible ValuesDescription
displayblock, inline, inline-block, flex, grid, noneDefines how an element is displayed
visibilityvisible, hidden, collapseControls whether an element is visible
overflowvisible, hidden, scroll, autoSpecifies how content overflows its box
z-indexauto, numberControls the stack order of elements (higher number appears in front)
opacity0 to 1 (decimal)Controls element transparency (0 = invisible, 1 = fully visible)


PropertyPossible ValuesDescription
positionstatic, relative, absolute, fixed, stickyDefines how an element is positioned
toppx, %, autoMoves element from the top edge (for relative, absolute, fixed)
rightpx, %, autoMoves element from the right edge
bottompx, %, autoMoves element from the bottom edge
leftpx, %, autoMoves element from the left edge
floatleft, right, noneMoves an element to the left or right
clearleft, right, both, nonePrevents elements from floating next to each other

Explanation of position Values

ValueBehavior
staticDefault positioning (normal document flow)
relativeMoves relative to its original position
absoluteMoves relative to the nearest positioned ancestor
fixedStays fixed in place even when scrolling
stickySticks to a position until scrolled past

Example:

.box {
    width: 200px;
    height: 100px;
    position: absolute;
    top: 50px;
    left: 100px;
    background-color: lightblue;
}

✔ Moves 50px from the top

✔ Moves 100px from the left

✔ Absolute positioning relative to the nearest positioned ancestor

Qus. 1 : What should be the value of the width attribute, so that the width of the element adjusts itself to the current width of its parent element?

  1. 100rem
  2. 100%
  3. 100vw
  4. 100em
Qus. 2 : What is the purpose of the CSS property position: relative;?

  1. Removes the element from the document flow
  2. Positions the element relative to its normal position
  3. Centers the element on the page
  4. Applies relative positioning to all child elements
Qus. 3 : <p>Match the CSS Position Property with Its Meaning</p><p><br></p><table class="table table-bordered"><tbody><tr><td><span style="font-size: 14px;"><b>CSS Position Property</b></span></td><td><span style="font-size: 14px;"><b>Meaning</b></span></td></tr><tr><td><span style="font-size: 14px;">A. static</span></td><td><span style="font-size: 14px;">1. Positions an element at a fixed place in the viewport</span></td></tr><tr><td><span style="font-size: 14px;">B. relative</span></td><td><span style="font-size: 14px;">2. The default position (no special positioning)</span></td></tr><tr><td><span style="font-size: 14px;">C. absolute</span></td><td><span style="font-size: 14px;">3. Positions the element relative to the nearest positioned ancestor</span></td></tr><tr><td><span style="font-size: 14px;">D. fixed</span></td><td><span style="font-size: 14px;">4. Moves the element relative to its normal position</span></td></tr><tr><td><br></td><td><span style="font-size: 14px;">5. Makes an element float over other elements</span></td></tr><tr><td><br></td><td><span style="font-size: 14px;">6. Aligns the element at the center of the page</span></td></tr></tbody></table><p><br></p>

  1. A → 5, B → 4, C → 3, D → 1
  2. A → 2, B → 4, C → 3, D → 1
  3. A → 5, B → 4, C → 3, D →6
  4. A → 4, B → 5, C → 3, D → 1

Programs

css code to design a box using div with following specifications

View Solution


css code to design a circle using div with following specifications

View Solution


css code to change the square into circle when mouse is over to the square shape

View Solution


css code to create 3 different colors box which partially overlapped to each other

View Solution


CSS code to blink text using keyframes

View Solution


Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad