p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning HTML, XHTML, CSS, and JavaScript (http://p2p.wrox.com/forumdisplay.php?f=541)
-   -   Question about <div> tag (http://p2p.wrox.com/showthread.php?t=78841)

andypandyrox456 April 4th, 2010 11:30 AM

Question about <div> tag
 
Hello everyone!
I have a question about the <div> tag.
I understand that you use this tag when you want to group certain items together.
However, when you use this tag, it transfers everything in this tag to the next line.
If you use the <div> tag only to put stuff on a new line, is there any difference between <div> and <br />?

PeterPeiGuo April 4th, 2010 12:12 PM

Try the following in your browser:
Code:

<div style="float: left">foo</div><div>bar</div>
As you can see, both foo and bar are displayed on the same line. CSS opens up the door for lots of nice things.

andypandyrox456 April 4th, 2010 01:12 PM

Quote:

Originally Posted by PeterPeiGuo (Post 255795)
Try the following in your browser:
Code:

<div style="float: left">foo</div><div>bar</div>
As you can see, both foo and bar are displayed on the same line. CSS opens up the door for lots of nice things.

Yes, I am currently reading about CSS.
So basically, with <div> you can align your text, while <br /> can't do that for you (it only makes a line break). Just wanted to make sure I got that right.
Also, the default value for <div> is center?


All times are GMT -4. The time now is 07:28 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.