Set page load to black instead of white background?

别说谁变了你拦得住时间么 提交于 2019-12-24 07:01:29

问题


Link to website:

http://www.ideagang.co/home.php

Is it possible to set the background to black when click from 1 page to another? Right now the website load perfectly with the black background, it's just that when I navigate from one page to another the page flickr for a second.....

Is there anyway to resolve this by setting the background to black when loading page internally?


回答1:


Not using only CSS. The browser's default color for the background is white, so the flicker you see is the default coming through for a split second before it has a chance to read the CSS rule to make it black.

The only way I can think of to get around this would be to load the first page, and then switch from page to page via javascript, loading them in to the exiting page. No reloads means no flicker. In my opinion, that is a ton of overhead for very little value, so I would suggest just living with it.




回答2:


I very much doubt this would be possible with CSS.

Have you tried using

<body background="#000"> 

It is long deprecated but may help. I think you will still get a white flash but it may be for less time.

You could also try putting a small block of CSS as the first thing in the header after your title.




回答3:


the html5 method of doing this via CSS is now:

<body style="background-color:#000">

also tried putting this CSS styling as the first thing in the <head> :

<style type="text/css">
    body{background-color:#000}
</style>

...but on my application it still resulted in a momentary white flash



来源:https://stackoverflow.com/questions/18937469/set-page-load-to-black-instead-of-white-background

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!