- This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
Viewing 9 posts - 1 through 9 (of 9 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hey guys,
New to the forum here and what better way to introduce yourself than showing you my problems with CSS.
I’ve started to create my own portfolio (well, I say started… you say typed three lines in CSS :P)
Anyway, what I’m trying to accomplish is 2 types of background [1 jpg stretched to 100% width and height and 1 png pattern centered and repeating] behind a centered content of x width and height.
Before adding the ‘content’ div, things were actually going smoothly and both images aligned perfectly.
But after adding the content, which is vertically centered with:
#content{
top:50%;
margin-top:-300;
height:600px;
{
the png background also moves 300 pixels up.
Now I’ve tried several things to make the png ‘ignore’ the margin-top but so far to no avail.
Do you guys have any tips and/or tricks to make this work?
Hugo
Yep sure do, instead of using a relative position use an absolute position so you end up with something like the below selector.
#content {
height: 600px;
left: 50%;
margin: -300px 0 0 -450px;
position: absolute;
top: 50%;
width: 900px;
}
Ah, thank you!
Solved it with
#content{
position:absolute;
top:50%;
margin-top:-300px;
left:50%;
margin-left:-450px;
height:600px;
width:900px;
background-color:#000000;
z-index:2;
}
Many thanks ^^
***
Can i mark this topic as solved somewhere? It was there with the first post, but I can’t edit it anymore…
You can’t edit the title of the post?
Nope, first comment is off limits to me :)
What about going to “My Discussions”, hover over this post, click options, edit, scroll down to “Mark as Solved”?
clicking options > edit gives me this:
Permission Problem
You don’t have permission to do that.
I’m not sure, then.
Still trying to figure out the issue. Have done it for you.