How does a container div work, and how is it coded?

I am working on a website, and have always centered them the same way, with tables. This time, I would like to familiarize myself with divs and css style sheets.

What is the code to create a container div? How you you place divs inside that container?

2 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    Essentially aDiv is a container.

    Think of the different sections of your site, you might have a header, navigation, content & a footer.

    You will have a div for each of these telling it where on the page to display, and all of these will be in one main 'container' div.

    <div id="container"> - the container div might have properties such as the width of the site & its alignment

    <div id="header"></div> - would have positioning properties & possibly the background image if you didn't want to embed this in the page

    <div id="navigation"></div> - the div that displays your navigation

    <div id="content"></div>- the div that displays your content

    <div id="footer"></div>- the div that displays your footer

    </div>

    • Login to reply the answers
  • 5 years ago

    This Site Might Help You.

    RE:

    How does a container div work, and how is it coded?

    I am working on a website, and have always centered them the same way, with tables. This time, I would like to familiarize myself with divs and css style sheets.

    What is the code to create a container div? How you you place divs inside that container?

    Source(s): container div work coded: https://biturl.im/FjRFI
    • Login to reply the answers
Still have questions? Get your answers by asking now.