/    Sign up×
Community /Pin to ProfileBookmark

Replicating <td>’s with CSS

I am just now converting from tables to divs and I cannot seem to figure out how to replicate the <td> function that table offers. Basically I just want to know how you can make two divs set next to each other (horizontal) instead of sitting on top of each other (vertical).

Sorry for what is probably a very remedial question.

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@dtm32236Dec 03.2007 — there may be a better way to do this, but my ghetto way of doing it is by adding float:left and width to the divs:

[code=html]<div style="float:left; width:50%;">content</div>
<div style="float:left; width:50%;">content</div>[/code]


and that should do it.
Copy linkTweet thisAlerts:
@cdp103188authorDec 03.2007 — Hmm, I pasted that code directly into my test page and while I can make the divs appear on the left or the right, they are still not side by side, one is jogged down to be below the other.
Copy linkTweet thisAlerts:
@dtm32236Dec 03.2007 — really?

try using 49%.

some browsers (IE6) only does this correctly if the sum percentage of the divs is under 100%.
Copy linkTweet thisAlerts:
@Declan1991Dec 03.2007 — Set their display as inline.
Copy linkTweet thisAlerts:
@cdp103188authorDec 03.2007 — OK, I'm a moron, thanks guys. Works fine.
×

Success!

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