/    Sign up×
Community /Pin to ProfileBookmark

Align two cells next to each other

I’m attempting to align two cells next to each other. The code i have works for IE but not Firefox. Firefox places the second cell (form-right) underneath the first cell (form-left). Here is the code i’m using.

[code=php]
<style type=”text/css”>
#form-left {
float:left;
width:45%;
}
#form-right {
width:45%;
}
</style>
</head>

<body>
<h3>Looking for work?</h3>
<div id=”form-left”>
Forename1:*
</div>
<div id=”form-right”>
Surname1:*
</div>
</body>
[/code]

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@kiwibritNov 01.2005 — Hmm.

My current style for left and right is:
.left {
clear: left;
float: left;
width:49%;
margin-bottom:.5em;
}

.right {
float:right;
width:50%;
margin-bottom:.5em;
}


Works fine for me - but I think floats in both left and right is frowned on by some.

Bottom margin is for spacing from further rows - when the left and right classes are placed in wrapping divs.

If you are only going to place things left and right once, id is fine. Otherwise I would use class.
Copy linkTweet thisAlerts:
@cootheadNov 01.2005 — Hi there silencer01,

try it like this...
[color=navy]&lt;style type="text/css"&gt;
#form-left {
float:left;
width:45%;
}
#form-right {[color=purple]
float:left;[/color]
width:45%;
}
&lt;/style&gt;[/color]

[i]coothead[/i]
×

Success!

Help @silencer01 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,
)...