当前位置:操作系统 > 安卓/Android >>

Android webkit css样式定制

 我们知道不同的浏览器对css有不同的解析方式,在android webkit 上面默认的定制自己样式的通道,假如我们对这个流程有一个比较清晰的了解,那么我们也可以自己去do itself。

       首先介绍下android webkit的默认的css样式表(声明我都是基于android4.0.1讲解),默认的css样式位置在(android/external/webkit/Source/WebCore/css/html.css)


[html]  * 
 * The default style sheet used to render HTML. 
 * 
 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 
 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 
 * 
 * This library is free software; you can redistribute it and/or 
 * modify it under the terms of the GNU Library General Public 
 * License as published by the Free Software Foundation; either 
 * version 2 of the License, or (at your option) any later version. 
 * 
 * This library is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
 * Library General Public License for more details. 
 * 
 * You should have received a copy of the GNU Library General Public License 
 * along with this library; see the file COPYING.LIB.  If not, write to 
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
 * Boston, MA 02110-1301, USA. 
 * 
 */ 
 
@namespace "http://www.w3.org/1999/xhtml"; 
 
html { 
    display: block 

 
/* children of the <head> element all have display:none */ 
head { 
    display: none 

 
meta { 
    display: none 

 
title { 
    display: none 

 
link { 
    display: none 

 
style { 
    display: none 

 
script { 
    display: none 

 
/* generic block-level elements */ 
 
body { 
    background-repeat:no-repeat !important; 
    display: block; 
    margin: 8px 

 
p { 
    display: block; 
    -webkit-margin-before: 1__qem; 
    -webkit-margin-after: 1__qem; 
    -webkit-margin-start: 0; 
    -webkit-margin-end: 0; 

 
div { 
    display: block 

 
layer { 
    display: block 

 
article, aside, footer, header, hgroup, nav, section { 
    display: block 

 
marquee { 
    display: inline-block; 
    overflow: -webkit-marquee 

 
address { 
    display: block 

 
blockquote { 
    display: block; 
    -webkit-margin-before: 1__qem; 
    -webkit-margin-after: 1em; 
    -webkit-margin-start: 40px; 
    -webkit-margin-end: 40px; 

 
figcaption { 
    display: block 

 
figure { 
    display: block; 
    -webkit-margin-before: 1em; 
    -webkit-margin-after: 1em; 
    -webkit-margin-start: 40px; 
    -webkit-margin-end: 40px; 

 
q { 
    display: inline 

 
q:before { 
    content: open-quote; 

 
q:after { 
    content: close-quote; 

 
center { 
    display: block; 
    /* special centering to be able to emulate the html4/netscape behaviour */ 
    text-align: -webkit-center 

 
hr { 
    display: block; 
    -webkit-margin-before: 0.5em; 
    -webkit-margin-after: 0.5em; 
    -webkit-margin-start: auto; 
    -webkit-margin-end: auto; 
    border-style: inset; 
    border-width: 1px 

 
map { 
    display: inline 

 
/* heading elements */ 
 
h1 { 
    display: block; 
    font-size: 2em; 
    -webkit-margin-before: 0.67__qem; 
    -webkit-margin-after: 0.67em; 
    -webkit-margin-start: 0; 
    -webkit-margin-end: 0; 
    font-weight: bold 

 
:-webkit-any(article,aside,nav,section) h1 { 
    font-size: 1.5em; 
    -webkit-margin-before: 0.83__qem; 
    -webkit-margin-after: 0.83em; 

 
:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 { 
    font-size: 1.17em; 
    -webkit-margin-before: 1__qem; 
    -webkit-margin-after: 1em; 

 
:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 { 
    font-size: 1.00em; 
    -webkit-margin-before: 1.33__qem; 
    -webkit-margin-after: 1.33em; 

 
:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 { 
    font-size: .83em; 
    -webkit-margin-before: 1.67__qem; 
    -webkit-margin-after: 1.67em; 

 
:-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) :-webkit-any(article,aside,nav,section) h1 { 
    font-size: .67em; 
    -webkit-margin-before: 2.33__qem; 
    -webkit-margin-after: 2.33em; 

 
h2 { 
    display: block; 
    font-size: 1.5em; 
    -webkit-margin-before: 0.83__qem; 
    -webkit-margin-after: 0.83em; 
    -webkit-

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,