- 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.
I want the 404 graphic and text to be placed in the center of the screen.
How about something like this :
body {
height: 100vh;
}
.container {
width: 960px;
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
margin: 0 auto;
}
where do i add that? or do i replace the old code?
thanks for your help
Here..
.error-404 {
width: 404px;
margin: 0 auto;
text-align: center;
position: absolute;
top:50%;
left:50%;
transform:translate(-50%, -50%);
border:1px solid lightgrey;
}
.logo-404 {
background-image: url(http://www.macmetro.com/wp-content/themes/macmetro/assets/logo-404.png);
width: 384px;
height: 216px;
margin: 0 10px 44px 10px;
}
Replacing the current code would indeed be best, @Rambo.
Many ways to get there but centering with transform would be the clue.
Thanks, I replaced that CSS and this is what happened.
Any easy fixes
Can you be specific…it centers fine.
If you mean the border…just remove it.
.error-404 {
width: 404px;
margin: 0 auto;
text-align: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 1px solid lightgrey; /* this */
}
I’m sorry, this is my fault. I want the 404 image/text to be centered in the upper part of the screen so people don’t have to look down to see the image.
So not this then….
I want the 404 graphic and text to be placed in the center of the screen.
Just adjust the top
value until you get what you want….however, if it’s centered there is no reason why anybody should look down.