Eliminate spaces

This is a discussion on "Eliminate spaces" within the Web Page Design section. This forum, and the thread "Eliminate spaces are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 27th, 2005, 20:58
SuperMember

SuperMember
Join Date: Nov 2005
Location: England
Age: 27
Posts: 308
Thanks: 1
Thanked 0 Times in 0 Posts
Question Eliminate spaces

I've mastered classes (.whatever) and i'm using them whenever u need to in the xhtml. But they have to be in between <p></p> tags don't they? And this means they create a space that u don't necessarily want. Is there any way of eliminating the space?

Thanks.
Reply With Quote

  #2 (permalink)  
Old Nov 27th, 2005, 23:59
Reputable Member
Join Date: Sep 2005
Location: Canada, BC
Age: 24
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Eliminate spaces

to get rid of the spaces created by <p></p> use
Code: Select all
p { margin: 0px; padding: 0px; }
But i'm not sure what you mean by they have to be inside a <p></p> could you clarify?
Reply With Quote
  #3 (permalink)  
Old Nov 28th, 2005, 00:00
herkalees's Avatar
Highly Reputable Member
Join Date: Jul 2005
Location: Massachusetts, USA
Age: 87
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to herkalees Send a message via MSN to herkalees Send a message via Yahoo to herkalees
Re: Eliminate spaces

No; class tags, as well as ID tags (you sure you know when to use which?) get added as attributes into just about any element. Like this:
Code: Select all
<p class="className"></p>
or
<h1 id="title"></h1>
or
<ul class="nav">
<li></li>
<li></li>
</ul>
I just re-read your post... if you're looking to remove the default padding/margin given by a browser to a paragraph tag, just do something like this:
Code: Select all
p {margin:0; padding:0;}
Reply With Quote
  #4 (permalink)  
Old Nov 28th, 2005, 00:06
SuperMember

SuperMember
Join Date: Nov 2005
Location: England
Age: 27
Posts: 308
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Eliminate spaces

I say they must be between <p></p> cos if they aren't then "class="whatever" " is treated as text. No?

<p class="whatever"> hello
</p>

would output: "hello" in whatever style, but:

class="whatever"> hello

would output: class="whatever"> hello
Reply With Quote
  #5 (permalink)  
Old Nov 28th, 2005, 00:12
Reputable Member
Join Date: Sep 2005
Location: Canada, BC
Age: 24
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Eliminate spaces

Well yes, but instead of <p> you can also use <div></div> or <span></span> almost any tag can have a class.
Reply With Quote
  #6 (permalink)  
Old Nov 28th, 2005, 01:22
SuperMember

SuperMember
Join Date: Nov 2005
Location: England
Age: 27
Posts: 308
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Eliminate spaces

Great. Thanks. Just to clarify: what do they mean, span/div, and what's the difference?
Reply With Quote
  #7 (permalink)  
Old Nov 28th, 2005, 01:27
Reputable Member
Join Date: Sep 2005
Location: Canada, BC
Age: 24
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Eliminate spaces

A div is a block, a span is inline.

You use span basicly the same way you would use a paragraph, accept you can have a span inside a paragraph (and I think you can have a span inside a span)

Quote:
Originally Posted by http://www.w3schools.com/css/pr_class_display.aspw3schools
block: The element will be displayed as a block-level element, with a line break before and after the element.
inline: The element will be displayed as an inline element, with no line break before or after the element
Reply With Quote
  #8 (permalink)  
Old Nov 28th, 2005, 01:35
SuperMember

SuperMember
Join Date: Nov 2005
Location: England
Age: 27
Posts: 308
Thanks: 1
Thanked 0 Times in 0 Posts
Re: Eliminate spaces

OK so a div doesn't create any space like a <p> does but it means that whatever follows goes on the next line? Whereas span means you can close stuff and whateevers next is on the same line, side by side like what i've done with the text and flash and have succeeded?

PS, are <br> s OK to use? Are they W3 acceptable? are they written </ br> ?
Reply With Quote
  #9 (permalink)  
Old Nov 28th, 2005, 01:37
Reputable Member
Join Date: Sep 2005
Location: Canada, BC
Age: 24
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Eliminate spaces

yeah something like that.

use <br />
Reply With Quote
  #10 (permalink)  
Old Nov 28th, 2005, 04:50
herkalees's Avatar
Highly Reputable Member
Join Date: Jul 2005
Location: Massachusetts, USA
Age: 87
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to herkalees Send a message via MSN to herkalees Send a message via Yahoo to herkalees
Re: Eliminate spaces

Quote:
Originally Posted by timmytots
OK so a div doesn't create any space like a <p> does but it means that whatever follows goes on the next line? Whereas span means you can close stuff and whateevers next is on the same line, side by side like what i've done with the text and flash and have succeeded?
PS, are <br> s OK to use? Are they W3 acceptable? are they written </ br> ?
A div will not create any padding or margin by default, because semantically, it isn't supposed to do anything but create a page division; a.k.a an area that divides up a page in one way or another.
A <p> element on the other hand is supposed to wrap a paragraph of text, and therefore, has natural padding and margins built into it prior to specifying anything with CSS.
To keep your code semantic, try to use <p>'s where they're proper; for paragraphs of text. Everything else should get a <div>, <span>, or another appropriate element.
<br /> are breaks, and shouldn't be used to mimmick the appearance of paragraphs. They can, it will work, but it's not the right way. A lot of "developers" will do the following to create the appearance of paragraphs:
Code: Select all
text text text text text text text
text text text text text text text
text text text text text
<br /><br />
text text text text text text text
text text text text text text text
When this is the correct way:
Code: Select all
<p>text text text text text text
text text text text text text text text text</p>
<p>text text text text text text
text text text text text text text text text</p>

Last edited by herkalees; Nov 28th, 2005 at 04:55.
Reply With Quote
Reply

Tags
eliminate, spaces

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Extra Spaces! CloudedVision Webforumz Suggestions and Feedback 1 Jun 2nd, 2008 01:01
How to eliminate the end extension in the address bar? linda_0 Web Page Design 4 Apr 28th, 2007 19:40
Files names without spaces cyberseed Web Page Design 18 Dec 18th, 2006 19:16
Spaces in HTML for a template necron_uk Web Page Design 11 Aug 9th, 2006 14:11
extra spaces removal = bad jakyra Webforumz Suggestions and Feedback 3 Sep 4th, 2003 18:18


All times are GMT. The time now is 00:32.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43