Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning HTML, XHTML, CSS, and JavaScript
This is the forum to discuss the Wrox book Beginning HTML, XHTML, CSS, and JavaScript by Jon Duckett; ISBN: 978-0-470-54070-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning HTML, XHTML, CSS, and JavaScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 4th, 2010, 11:30 AM
Registered User
 
Join Date: Apr 2010
Location: Planet Earth
Posts: 70
Thanks: 4
Thanked 0 Times in 0 Posts
Default 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 />?
  #2 (permalink)  
Old April 4th, 2010, 12:12 PM
Friend of Wrox
 
Join Date: Dec 2008
Location: , , .
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default

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.
  #3 (permalink)  
Old April 4th, 2010, 01:12 PM
Registered User
 
Join Date: Apr 2010
Location: Planet Earth
Posts: 70
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by PeterPeiGuo View Post
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?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Page Container <div> and another ,div. not behaving as expected SouthendSupporter ASP.NET 3.5 Basics 8 December 15th, 2009 10:05 AM
How can I stop <DIV> tag wrapping sinkalanick CSS Cascading Style Sheets 3 February 19th, 2007 09:16 PM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
sizeable <div> johnjohn Javascript How-To 1 December 8th, 2004 08:28 PM
<A><DIV><TABLE></DIV></A> anshul HTML Code Clinic 2 July 17th, 2004 02:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.