SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: correct use of <div>?
-
Aug 17, 2001, 05:53 #1
- Join Date
- Feb 2001
- Location
- London
- Posts
- 344
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
correct use of <div>?
Hi
I have a client who is questioning my use of the div tag to apply classes to small areas of text such as : <div class="mystyle">text</div>
It works fine but they are implying that it's a bit of a hack - what is the correct usage of this tag? - can anyone tell me what the the div tag stands for and is it compliant/good practice to use it to apply text formatting to a single line of text?
Thanks for any comments.gorillaweb is a small London based digital design agency.
-
Aug 17, 2001, 06:04 #2
- Join Date
- Feb 2001
- Location
- Stockport, UK
- Posts
- 729
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
<div> is a block level attribute like <p> for small inline class changes you should use <span>.
-
Aug 17, 2001, 06:15 #3
- Join Date
- Feb 2001
- Location
- London
- Posts
- 344
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
cheers sowen that would explain why you get an automatic line break after using div. I'll use span from now on which presumably doesn't give the line break.
gorillaweb is a small London based digital design agency.
-
Aug 17, 2001, 06:23 #4
- Join Date
- Jul 2001
- Location
- Berkshire, UK
- Posts
- 7,442
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
you can also use class which becomes part of <P> also i.e. <P class=style>
-
Aug 17, 2001, 09:29 #5
- Join Date
- Oct 2000
- Location
- Nashvegas Baby!
- Posts
- 7,845
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You can apply a class to ANY HTML tag. As mentioned earlier, DIV is a block level element and as such implies a carriage return after the closing tag.
SPAN is the best tag to use to apply formatting to a single word or sentence.Adobe Certified Coldfusion MX 7 Developer
Adobe Certified Advanced Coldfusion MX Developer
My Blog (new) | My Family | My Freelance | My Recipes
Bookmarks