Skip to main content
Inspiring
December 23, 2017
Answered

Do divs have sizes?

  • December 23, 2017
  • 2 replies
  • 341 views

I'm trying to figure how how divs differ from tables. Do dives have sizes?

    This topic has been closed for replies.
    Correct answer Nancy OShea

    AnotherMe  wrote

    Do dives have sizes?

    Sure they do.  In simplest terms, a division is a box.   Refer to the CSS Box Model.

    A division's size is its width + margins + padding + borders.  Height is determined by content inside the box.  Thus there's no need to set explicit height values on divs that contain content.

    In responsive layouts, we typically give divisions a % width instead of fixed pixels.  But there are times when you might need to use other CSS Units .

    2 replies

    Nancy OShea
    Community Expert
    Nancy OSheaCommunity ExpertCorrect answer
    Community Expert
    December 23, 2017

    AnotherMe  wrote

    Do dives have sizes?

    Sure they do.  In simplest terms, a division is a box.   Refer to the CSS Box Model.

    A division's size is its width + margins + padding + borders.  Height is determined by content inside the box.  Thus there's no need to set explicit height values on divs that contain content.

    In responsive layouts, we typically give divisions a % width instead of fixed pixels.  But there are times when you might need to use other CSS Units .

    Nancy O'Shea— Product User & Community Expert
    BenPleysier
    Community Expert
    Community Expert
    December 23, 2017

    A DIV is a block level element just like

    <address><article><aside><blockquote><canvas><dd><div><dl><dt><fieldset><figcaption><figure><footer><form><h1>-<h6><header><hr><li><main><nav><noscript><ol><output><p><pre><section><table><tfoot><ul><video>

    A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as far as it can).

    This behaviour can be changed by using style rules (CSS).

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!