Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 05-01-2012, 12:29 PM   #1 (permalink)
Freelance web designer
 
gdebojyoti's Avatar
 
Join Date: Sep 2011
Location: Durgapur
Posts: 59
Question Problem with horizontal bar in HTML-CSS


I wanted to create a horizontal bar at the top of my HTML web page. I used the following code for that:

Code:
<html>

<body>

	<div style="width:100%; height:40px; background-color:olive; margin: 0 0 0 0;" align="center">
		Hello
	</div>

</body>

</html>
But a white space appears all around the bar. ( http://www.debojyotighosh.com/projects/isn/test1.html )

Is there any way by which this space can be avoided (other than using negative values in "margin")?
gdebojyoti is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 07-01-2012, 03:45 AM   #2 (permalink)
Undead!!!
 
Sujeet's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 1,632
Default Re: Problem with horizontal bar in HTML-CSS

add padding:0 and margin:0 attribute to body!!!!


Code:
<html>

<body style="margin:0; padding:0;">

	<div style="width:100%; height:40px; background-color:olive; margin: 0 0 0 0;" align="center">
		Hello
	</div>

</body>

</html>
Sujeet is offline   Reply With Quote
Old 07-01-2012, 10:00 AM   #3 (permalink)
Rising Sun!
 
buddyram's Avatar
 
Join Date: Feb 2011
Location: Bengalooor
Posts: 232
Default Re: Problem with horizontal bar in HTML-CSS

^^I guess body tag adds some value to margin and padding attributes by default
does it?
__________________
“An expert is a man who tells you a simple thing in a confused way in such a fashion as to make you think the confusion is your own fault.” – William Castle
buddyram is online now   Reply With Quote
Old 07-01-2012, 08:52 PM   #4 (permalink)
Freelance web designer
 
gdebojyoti's Avatar
 
Join Date: Sep 2011
Location: Durgapur
Posts: 59
Default Re: Problem with horizontal bar in HTML-CSS

@Sujeet: Thanks a lot! It worked.

@buddyram: Yup. Seems like that.
gdebojyoti is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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


 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:38 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2