Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB 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
 
Old April 12th, 2013, 06:16 PM
Friend of Wrox
 
Join Date: May 2011
Posts: 411
Thanks: 13
Thanked 7 Times in 7 Posts
Default Which div....

goes with which div tag? I was doing the examples on page 457 of your book and I was just wondering is there any way at all in Visual Studio which </div> tag goes with which <div> tag, kind of like what they do with opening braces ( and closing braces in { in Csharp code? Sometimes keep up with which Div tag goes with which closing Div tag can get kind of confusing. If you put the wrong </div> tags in the wrong place it can throw your CSS styling of your HTML elements off, can it not?
 
Old April 15th, 2013, 09:30 AM
Authorized User
 
Join Date: Jan 2013
Posts: 29
Thanks: 1
Thanked 1 Time in 1 Post
Default

It's based on level matching, just like all other tags. You can't differentiate between them except by making sure you indent to the level that they are visibly paired. For example:

<div>
xx<div>
xxxx<div>
xxxx</div>
xx</div>
</div>

The best way to approach divs (and all other tags) is to write the opening and closing at the same time. For example:

<div>
xx**Start typing code here after putting the opening and closing div tags in place.
</div>

This approach will make it so that you won't have issues with unmatched tags. Visual Studio actually does a pretty good job of this on its own; many tags will auto-generate a close as soon as you type the open segment.
 
Old April 15th, 2013, 10:25 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Also, if your HTML code is valid, Visual Studio highlights the closing or opening tag of the associated opening or closing tag if you click it. Other useful tools are:

1. Edit | Format Document This lines up the code as Thermopyle described.

2. Use the + and - icons in the code editor's gutter to collapse complete elements.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





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
div within a div and inherting the height brettdavis4 CSS Cascading Style Sheets 1 January 23rd, 2007 09:59 AM
Div Question interrupt Javascript How-To 8 July 19th, 2005 08:46 AM
Div again... Nitin_sharma HTML Code Clinic 3 February 11th, 2005 04:28 AM
div DSteven CSS Cascading Style Sheets 2 February 9th, 2005 11:36 AM





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