/    Sign up×
Community /Pin to ProfileBookmark

I have two divs on my home page. I have set it so that they will float left but I had to get rid of the margin-left margin-right thing in order to put some space in between them, so thay aren’t centered. So when some one opens them up in a browser and changes the size of browser window the div on the right slides under the div on the left. How do I fix it so that when some one changes there browser window it stay centered?

[URL=http://www.zipzapgaming.com]See for yourself.[/URL]

[CODE].newgame {
color: #FFFFFF;
overflow: hidden !important;
background: #333333;
border: 1px solid #000000;
height: 165px;
width: 49%;
float: left;
margin: 0px;
margin-left: 2px;
margin-right: auto;
padding: 0px;
}

.newgame h1 {
font-family: Verdana, Geneva, Arial, helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
background: url(http://www.zipzapgaming.com/images/block_subhd.gif) repeat;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
margin: 0px;
padding: 3px;
}

.newpost {
color: #FFFFFF;
overflow: hidden !important;
background: #333333;
border: 1px solid #000000;
height: 165px;
width: 49%;
float: left;
margin: 0px;
margin-left: 3px;
margin-right: 2px;
padding: 0px;
}

.newpost h1 {
font-family: Verdana, Geneva, Arial, helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
background: url(http://www.zipzapgaming.com/images/block_subhd.gif) repeat;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
margin: 0px;
padding: 3px;
}[/CODE]

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@The_Little_GuyFeb 21.2006 — Add this to the CSS
[CODE].clear {
clear:both;
font-size:1px;
line-height:0px;
}[/CODE]

The HTML
[CODE] <div class="Middlecol">
<div class="newgame">
<h1>Newest Game</h1> <br>

<center>Bush Shootout <br>
<a href="http://www.games.zipzapgaming.com/shootem_up/B/bush_shootout.php" title="Play our newest game..."><img src="http://www.zipzapgaming.com/images/new_game.jpg"></a></center>
</div>
<div class="newpost">
<h1>Newest Post</h1> <br>
<marquee behavior="scroll" direction="up" height="100px" scrollamount="3" onmouseover='this.stop()' onmouseout='this.start()'><img src="http://www.zipzapgaming.com/images/new_post.gif">&nbsp;&nbsp;General Discussion: <a href="http://www.forums.zipzapgaming.com/viewforum.php?f=1&sid=945f42974df91d00af025acf9f6a0ae2">Rules</a> <br>

By: Admin</marquee> <br>
<center><a href="http://www.forums.zipzapgaming.com" title="Go to our forum...">Access Forums</a></center>
[COLOR=Red] <div class="clear">&nbsp;</div>
</div>
<div class="clear">&nbsp;</div>[/COLOR]
</div>[/CODE]

The Change I made is in red

I hope this works for you.

float "newgame" and "newpost" left
Copy linkTweet thisAlerts:
@BOB101authorFeb 22.2006 — It didn't work, dude.
Copy linkTweet thisAlerts:
@bathurst_guyFeb 22.2006 — I dont see your problem in firefox atm, and i couldnt be bothered opening IE lol
Copy linkTweet thisAlerts:
@BOB101authorFeb 22.2006 — Cuz I just updated my css file.

But now I have another problem. I want to space out my Newest Game and Newest Post divs. But since I have to use the margin-left: auto; margin-right: auto; to center them both and from keeping them from going under each other, how do I space them out?
Copy linkTweet thisAlerts:
@bathurst_guyFeb 22.2006 — I don't see why the margin has to be set at auto? Why not set the width of the divs at say 40% and then the margins at like 5%
×

Success!

Help @BOB101 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...