/    Sign up×
Community /Pin to ProfileBookmark

asigning left position while held in a div

I have a simple Div that’s got a left of 50px, inside is a span that should be aligned 75px from the left side of the div, but what I’m using fails to work:

[code]
<style type=”text/CSS”>
div {
position: absolute;
left: 50px;
background-color: #000000;
}

span {
left: 75px; /* this doesn’t work.(or at least not in IE)*/
background-color: #FFFFFF;
}
</style>
<div>
<span>Some content goes here</span>
</div>[/code]

This example neglects the fact that I use dynamic content(which means the position can be absolute since I don’t know how much content will go in the message before it…) and that I will have various spans contained within this div.

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@PittimannJan 19.2005 — Hi!

What about adding 'padding-left:75px;' to the css for the div?

Cheers - Pit
Copy linkTweet thisAlerts:
@NogDogJan 19.2005 — Assuming I understand correctly, either add "position: relative" to the span, or else for the span change "left:" to "margin-left:".

Hope that helps.
Copy linkTweet thisAlerts:
@scragarauthorJan 19.2005 — that works now, thank's nogdog.

And thanks for the try Pittimann.
×

Success!

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