开发者

Weird problems with CSS position:absolute

开发者 https://www.devze.com 2023-04-07 15:02 出处:网络
I am having som开发者_高级运维e really weird problems with position:absolute. I have set the main title of my webpage to be position absolute, but when I resize the window, the text moves around. The

I am having som开发者_高级运维e really weird problems with position:absolute. I have set the main title of my webpage to be position absolute, but when I resize the window, the text moves around. The really weird thing is that the tagline (the Bible verse) is also position:absolute, but it isn't having any problems. Any suggestions?


I'm guessing your screen resolution is 1920x1080? Looks like you've gone and positioned the element relative to the window, which only works if the window is that size.

Try removing the position: absolute and the right properties, and using float:right instead of float:left.

As for the tagline element, you made it position: relative and float: right. position: relative, here, does absolutely nothing.


I suggest adding the position: relative to the #logoWrapper:

#logoWrapper {
    ...
    position: relative;
    ...
}

Thus its children with position: absolute will be positioned relatively to the #logoWrapper, not the body, as Kolink said.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号