/    Sign up×
Community /Pin to ProfileBookmark

How do I define a gap?

Hi guys,
I have two <div>’s vertically aligned. I want a third div to seperate them by a small gap. SO we have

<div class=”1″></div>
<div class=”gap”></div>
<div class=”2″></div>

But when I set the height of the gap div, it doesn’t seem to work. It always seems to set to a minumum of one character?? With a height of zero it is atill one char. With a height of -1, the height goes to zero!! AARGH!!! How do I do this?

to post a comment
CSS

6 Comments(s)

Copy linkTweet thisAlerts:
@MstrBobAug 11.2004 — if you've want a gap, use margins:

<i>
</i>&lt;div style="width:300px;float:left;margin-right:10px;"&gt;
....text here....
&lt;/div&gt;

&lt;div style="width:300px;float:right;margin-left:20px;"&gt;
....more text here....
&lt;/div&gt;


The left and right margins add up to 20px. You can make it as much as you want, and you could just put the margin in one div. Unlike with tables, there's no need for empty elements. Infact, empty elements incress source size and are unsemantic.
Copy linkTweet thisAlerts:
@SuzanneBauthorAug 11.2004 — No, I mean a vertical gap. And I can't use margins, because all three div's use different backgrounds, so the gap must be a different div. I think??
Copy linkTweet thisAlerts:
@MstrBobAug 11.2004 — Why not just set the body to have that background, and use margins? And if you need a vertical gap, than use margin-top and margin-bottom .
Copy linkTweet thisAlerts:
@SuzanneBauthorAug 11.2004 — I will try it and see what happens ?
Copy linkTweet thisAlerts:
@pawkyAug 11.2004 — also, instead of using margin-top: 10px; and margin-right: 10px; etc... just use one margin: __px __px __px __px;

the order that it is read is top right bottom left. if u have just two numbers the first will be for top and bottom and the second for left and right. and if u have 3 numbers 1st is for right 2nd top and bottom and 3rd for left. also if u have just 1 it applies to all ? this will just help cut the code down a tad if u do go with this ?
Copy linkTweet thisAlerts:
@MstrBobAug 12.2004 — I prefer to use that, but some older browsers have issues reading it. Plus, when simply defining two, I'd say it's a toss up. For 3 or more, I go with that anyway. Guess I'm indecisive.
×

Success!

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