標籤:
問題描述:
這個問題是一個同事在寫手機頁面用UC瀏覽器測試以後遇到的,其他瀏覽器靜態頁面顯示正常,唯獨UC瀏覽器不顯示頁面樣式。
我測試過代碼是沒有問題的,因為臨時沒有找到安卓手機,就猜想PC端的應該跟手機端會有同樣的問題,畢竟是同樣的核心嘛。
然而PC上用UC瀏覽器看或者內建的手機模擬器都沒有任何問題,唯獨手機上不行。
解決方案:如,審查元素髮現,尼瑪,居然UC瀏覽器預設給head加了一個dislay:none;隱藏屬性,然後試著把引入的css檔案放在head之外,就可以正常顯示了。
不過據同事反映,雖然能夠顯示頁面了,但是用了定位和浮動屬性的地方,顯示還是會亂,應該是UC瀏覽器本身不支援的原因
百度的UC瀏覽器不支援css屬性的
注:此代碼為測試代碼,並未添加定位和浮動等相關屬性
頁面代碼:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="textml; charset=ISO-8859-1"><meta name = "format-detection" content = "telephone=no"><meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no"><title>Insert title here</title><style>.newBoy{ display:block; width:50px; height:500px; background:red;}.newBoy2{ width:20vw; height:20vw; background:green;}.newBoy3{ width:50rem; height:50rem; background:pink;}.newBoy4{ width:50em; height:50em; background:yellow;}.newBoy5{ width:50pt; height:50pt; background:red;}.newBoy6{ width:50%; height:50%; background:black;}</style></head><body> <div class="newBoy" style="width:50px;height:50px;"></div> <div class="newBoy2"></div> <div class="newBoy3"></div> <div class="newBoy4"></div> <div class="newBoy5"></div> <div class="newBoy6"></div> <span class="newBoy">123</span> <p>asdasda</p></body><html>
用手機內建uc瀏覽器查看靜態頁面,css樣式不顯示