MyInternships.in

CSS References

CSS Reference

This CSS reference is a master table of the properties you reach for most often when styling real web pages. Properties are grouped by purpose — text and fonts, the box model, colours and backgrounds, layout with Flexbox and Grid, positioning, transforms, transitions and more — so you can scan a category and find the right tool quickly. Every property listed here is widely supported in modern browsers.


How to read a CSS property

Every CSS rule is made of a selector and a declaration block. Inside the block you write declarations, and each declaration is a property followed by a colon and a value, ending in a semicolon. The property name decides what visual aspect you are changing; the value decides how. The tables below list the property and describe what it does — pair them with the value guides on units, colours and functions to write complete declarations.

selector {
  property: value;      /* one declaration */
  color: #0f766e;       /* text colour */
  padding: 16px;        /* inner spacing */
}
💡

Use shorthand properties (margin, padding, background, font, border) to set several related values in one line. Longhand properties (margin-top, background-color) give you finer control when you need it.

Text and font properties

These properties control how text looks: its typeface, size, weight, spacing, alignment and decoration.

PropertyDescription
colorSets the colour of the text.
font-familySpecifies the typeface, with fallbacks (a font stack).
font-sizeSets the size of the text, e.g. 16px or 1rem.
font-weightSets how bold text is (normal, bold, 100–900).
font-styleSets italic or oblique text.
line-heightSets the height of each line of text (spacing between lines).
letter-spacingAdjusts space between characters.
word-spacingAdjusts space between words.
text-alignAligns inline content: left, right, center or justify.
text-decorationAdds underline, overline, line-through or none.
text-transformChanges case: uppercase, lowercase or capitalize.
text-indentIndents the first line of a block of text.
text-shadowAdds a shadow behind text.
white-spaceControls how whitespace and line breaks are handled.
text-overflowSets how clipped text is signalled, e.g. ellipsis.
vertical-alignAligns inline or table-cell content vertically.

Box model properties

The box model describes the rectangular boxes generated for every element: content, padding, border and margin. These properties size and space those boxes.

PropertyDescription
widthSets the content width of an element.
heightSets the content height of an element.
max-widthLimits how wide an element can grow.
min-widthSets the smallest width an element may shrink to.
max-heightLimits how tall an element can grow.
min-heightSets the smallest height an element may shrink to.
marginSpace outside the border (shorthand for all four sides).
paddingSpace inside the border, around the content.
borderShorthand for border width, style and colour.
border-radiusRounds the corners of the box.
box-sizingControls whether width/height include padding and border.
outlineA line drawn outside the border; does not affect layout.
overflowControls content that overflows: visible, hidden, scroll, auto.
box-shadowAdds one or more shadows around the box.
ℹ️

Set box-sizing: border-box on everything (often via *) so width and height include padding and border. It makes layouts far more predictable.

Background and colour properties

PropertyDescription
backgroundShorthand for all background properties.
background-colorSets a solid background colour.
background-imageSets one or more background images or gradients.
background-sizeSizes the background image: cover, contain or a length.
background-positionPositions the background image within the box.
background-repeatControls tiling: repeat, no-repeat, repeat-x/y.
background-attachmentFixes the background to the viewport or scrolls it.
opacitySets the transparency of the whole element (0–1).
filterApplies graphical effects like blur() or brightness().
mix-blend-modeBlends an element with the content behind it.

Layout: display, position and float

PropertyDescription
displaySets the box type: block, inline, flex, grid, none, etc.
positionSets positioning scheme: static, relative, absolute, fixed, sticky.
top / right / bottom / leftOffsets a positioned element from its containing block.
z-indexSets stack order of positioned/flex/grid items.
floatFloats an element left or right; text wraps around it.
clearPrevents an element from sitting beside a float.
visibilityShows or hides an element while keeping its space.
object-fitHow replaced content (img/video) fills its box.
aspect-ratioSets a preferred width-to-height ratio for the box.

Flexbox properties

PropertyDescription
flex-directionMain axis direction: row, row-reverse, column, column-reverse.
flex-wrapWhether items wrap onto multiple lines.
justify-contentAligns items along the main axis.
align-itemsAligns items along the cross axis.
align-contentAligns wrapped lines within the container.
gapSets spacing between flex (or grid) items.
flex-growHow much an item grows relative to siblings.
flex-shrinkHow much an item shrinks relative to siblings.
flex-basisThe initial main size of a flex item.
orderReorders a flex/grid item without changing HTML.
align-selfOverrides align-items for a single item.

Grid properties

PropertyDescription
grid-template-columnsDefines the column tracks of the grid.
grid-template-rowsDefines the row tracks of the grid.
grid-template-areasNames areas for a visual layout map.
grid-columnPlaces an item across columns (start / end).
grid-rowPlaces an item across rows (start / end).
grid-auto-flowHow auto-placed items fill the grid.
grid-auto-rowsSize of implicitly created rows.
place-itemsShorthand for align-items and justify-items.
place-contentShorthand for align-content and justify-content.

Transitions, transforms and animation

PropertyDescription
transitionShorthand to animate property changes over time.
transition-propertyWhich properties to animate.
transition-durationHow long the transition takes.
transition-timing-functionThe easing curve, e.g. ease, linear, cubic-bezier().
transformApplies translate, rotate, scale or skew.
transform-originThe point transforms are applied around.
animationShorthand to run a @keyframes animation.
animation-nameThe @keyframes rule to run.
animation-durationHow long one cycle of the animation lasts.
animation-iteration-countHow many times the animation runs.
will-changeHints to the browser which properties will change.
💡

For smooth animation prefer transform and opacity — the browser can animate them on the GPU without triggering layout or paint.

Miscellaneous useful properties

PropertyDescription
cursorSets the mouse cursor, e.g. pointer, text, not-allowed.
pointer-eventsControls whether an element responds to the pointer.
user-selectControls whether text can be selected.
list-styleShorthand for list marker type, position and image.
contentInserts generated content with ::before / ::after.
scroll-behaviorEnables smooth scrolling for the page or a container.
accent-colorTints form controls like checkboxes and radios.
caret-colorSets the colour of the text-input cursor.
ℹ️

This list is a starting point, not the whole language. See the dedicated reference pages for selectors, functions, units, colours and at-rules to complete your toolkit.

Related CSS Topics

Keep learning with these closely related tutorials.

Ready to use your CSS skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships