Current location: Hot Scripts Forums » General Web Coding » CSS » div positioning


div positioning

Reply
  #1 (permalink)  
Old 09-16-05, 12:30 AM
the_mole001's Avatar
the_mole001 the_mole001 is offline
Newbie Coder
 
Join Date: Feb 2004
Location: Australia
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Question div positioning

hey guys,

I am working on a site for a club im currently with and i want to build a news section with all the news articles and a search box next to it for easy searching ability. The code i have produced works fine in internet explorer, that is that the news article and search box both sit at the top of the page and sit next to one another, but when i view the page in mozilla firefox the searchbox pushes the news article under it and i loose the effect i am after. I was wondering if anyone knew what i had to change so that the page looked the same in both ie and firefox? Any help you could provide would be very much appreciated. Peter

Code:
<style type='text/css'>
.mnews { width: 600px; }
.news { float: left; }
.snews { float: right; width: 154px; padding: 0px; border: 2px solid #000000; }
.stitle { background-color: #339933; text-align: center; color: #ffffff; font-weight: bold; }
.sbody { padding: 2px; }
.content { padding: 5px, 0px, 8px, 10px; }
.narticle { border: 2px solid #ff3300; font-family: verdana; }
.ntitle { background-color: #ffcc00; padding: 3px; font-weight: bold; }
.nposted { padding: 2px; font-size: 12px; background-color: #ffcc00; }
.nattatch { padding: 2px; font-size: 12px;  background-color: #ffffaa; }
.nbody { padding: 4px; }
</style>
<div class='mnews'>
	<div class='snews'>
		<div class='stitle'>Search News</div>
		<div class='sbody'>Enter Keyword:<br><input type='text'><br><input type='submit' value='Search'></div>
	</div>
	<div class='news'>
		<div class='narticle'>
			<div class='ntitle'>The title of the news</div>
			<div class='nposted'>Posted by the poster on the ddth of mm yyyy at hh:mm A</div>
			<div class='nattatch'>Attatchments: None</div>
			<div class='nbody'>The message body for which i can put in any types of news</div>
		</div>
	</div>
</div>
__________________
Current Project: GGAC Website
Project Link: http://peter.5gigs.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-16-05, 07:53 AM
karlcore karlcore is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
How about an URL?
Looking at the code you supplied is not enough.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-16-05, 08:01 PM
the_mole001's Avatar
the_mole001 the_mole001 is offline
Newbie Coder
 
Join Date: Feb 2004
Location: Australia
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
__________________
Current Project: GGAC Website
Project Link: http://peter.5gigs.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 09-24-05, 11:20 PM
Richard's Avatar
Richard Richard is offline
Wannabe Coder
 
Join Date: Sep 2005
Location: Oxford, UK
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
I think the padding of the div's is forcing the .news down a row. I would suggest setting the width of .news to something like 500, and then adding 154 (the width of .snews), and then to fit with the padding, add another 10. Something like...
Code:
.mnews { width: 664px; }
.news { float: left; width: 500px; }
Should work ok
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 09-25-05, 01:37 AM
the_mole001's Avatar
the_mole001 the_mole001 is offline
Newbie Coder
 
Join Date: Feb 2004
Location: Australia
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
thanks richard! your idea worked a treat. i was just trying to see if i could get it to do it automatically as i dont know what all users screen resolutions will be so i wanted them to get a fullpage effect no matter what the res, but it till looks good if i condence it a little. thanks for the help.
__________________
Current Project: GGAC Website
Project Link: http://peter.5gigs.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 09-25-05, 06:56 PM
Richard's Avatar
Richard Richard is offline
Wannabe Coder
 
Join Date: Sep 2005
Location: Oxford, UK
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by the_mole001
thanks richard! your idea worked a treat. i was just trying to see if i could get it to do it automatically as i dont know what all users screen resolutions will be so i wanted them to get a fullpage effect no matter what the res, but it till looks good if i condence it a little. thanks for the help.
Nps. If you want it to fit no matter what the width of the screen/resolution is, you could always try percentages
Code:
.mnews { width: 100%; }
.news { width: 60%; float: left; }
.snews { float: right; width: 40%; padding: 0px; border: 2px solid #000000; }
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Div Scrolling dwoody CSS 2 12-28-06 08:59 PM
Show hidden DIV from a link on another page? jbreaker HTML/XHTML/XML 8 07-11-05 07:48 PM
div positioning koncept CSS 3 05-17-05 01:34 PM
semi-dynamic div height changes koncept JavaScript 2 05-03-05 11:20 AM
Change width of div if another div is not present hockeykid JavaScript 2 12-08-04 08:27 PM


All times are GMT -5. The time now is 08:20 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.