IT2805 Web technologies
  • Introduction
  • Web architecture
  • The Internet
  • Developing for the web
  • Document Object Model
  • HTML
    • Document Structure
    • Attributes
    • Text
    • Lists
    • Links
    • Images
    • Tables
    • Comments
    • Semantic elements
  • Site structure
  • CSS intro
    • Understanding CSS
    • Syntax
    • Comments
    • Cascade
    • Inheritance
    • Selectors
    • Color
    • Margin and padding
    • Center elements
    • Borders
    • Text and fonts
    • Pseudo-classes
  • CSS continued
    • Styling lists
    • Change between inline and block elements
    • Hide boxes
    • Document flow
    • Inheritance
    • More pseudo-classes
    • Overflow
  • Web and multimedia
    • Images
    • Video
    • Audio
  • Forms and validation
    • The form element
    • Form structure
    • Form validation
    • How to design a form
  • Responsive web design
    • Media types
    • Media features
    • Logical operators
  • Introduction to JavaScript
    • How and where to write JavaScript
    • Comments
    • Data types
    • Logical operators
    • Variables and constants
    • When something doesn't exist
    • Control structures
    • Arrays
    • Objects
    • Loops
    • Functions
    • JSON
  • Dynamic websites
  • JavaScript continued
    • Arrays
    • Scope
    • Time
    • Document Object Model
    • Events
  • XML
  • Canvas
Powered by GitBook
On this page

Was this helpful?

  1. CSS intro

Center elements

If you want to center your content in the browser window, that is center your outer element, you can use margin-left:auto and margin-right:auto to do so. Your element needs then to be less than 100% of the browser window.

PreviousMargin and paddingNextBorders

Last updated 4 years ago

Was this helpful?