-2

I am learning how to code HTML from websites and other people. This one site mentioned the <div> and <span> element but didn't really give a good definition of them. Can someone tell me exactly what they are for and how to use them?

Rich Bradshaw
  • 71,795
  • 44
  • 182
  • 241
WoojinL
  • 11
  • 5

3 Answers3

1

Divs are sort like the blocked pieces of a website

  • EXAMPLES : Header, body, footer, login-box

Spans are typically for inline elements such as text

  • EXAMPLES : Paragraphs, titles

Both pretty much do the same thing (You will use the div more often).

  • How are they used though? – WoojinL Apr 24 '14 at 00:30
  • `Hello World` and `
    Block codes
    ` You can style these elements by giving them an id : EXAMPLE : `
    ` Now to style them go to the css file and (hopefully you know css) do this div#theID { properties; }
    –  Apr 24 '14 at 02:20
-1

Both mean nothing, but div is a block element and span is inline.

Rich Bradshaw
  • 71,795
  • 44
  • 182
  • 241
-1

Div tends to be for a container that will house a few to many elements. A span tag is a more suitable for a single string of text, traditionally.

wootscootinboogie
  • 8,461
  • 33
  • 112
  • 197