使用自定义css与gwt [英] use custom css with gwt
问题描述
如何设置gwt使用我的自定义CSS来进行化妆?
这些链接根本没帮助我:
https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCss?hl=cs
http://code.google.com/p/google-web-toolkit-doc-1-5/wiki / GettingStartedStyle#Default_styles
How do I set up gwt to use my custom css for the makeup ? These links didn't help me at all: https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCss?hl=cs http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/GettingStartedStyle#Default_styles
- 问题是我无法获取gwt来检测我在我的lorum中声明的css文件.gwt.xml文件,当我启动调试模式时,jetty在启动时在日志输出中出现以下错误:
:
00:00:00.811 [WARN] 404 - GET /lorum/stylesheet.css (127.0.0.1) 1418 bytes
00:00:00.811 [INFO] Request headers
00:00:00.811 [INFO] Host: 127.0.0.1:8888
00:00:00.811 [INFO] Connection: keep-alive
00:00:00.811 [INFO] User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Ubuntu/11.10 Chromium/18.0.1025.168 Chrome/18.0.1025.168 Safari/535.19
00:00:00.811 [INFO] Accept: text/css,*/*;q=0.1
00:00:00.811 [INFO] Referer: http://127.0.0.1:8888/Home.html?gwt.codesvr=127.0.0.1:9997
00:00:00.812 [INFO] Accept-Encoding: gzip,deflate,sdch
00:00:00.812 [INFO] Accept-Language: en-US,en;q=0.8
00:00:00.812 [INFO] Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
00:00:00.812 [INFO] Cookie: JSESSIONID=ywoku1zfjs0b
00:00:00.812 [INFO] Response headers
00:00:00.812 [INFO] Content-Type: text/html; charset=iso-8859-1
00:00:00.812
加载我的css。
lorum.gwt.xml来源:
l version="1.0" encoding="UTF-8"?>
<module rename-to='lorum'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.user.theme.chrome.Chrome'/>
<inherits name="com.google.gwt.resources.Resources" />
<inherits name="com.company.lorum.gwt.client.stylesheet.css"/>
<entry-point class='com.company.lorum.gwt.client.LoadModuleLorum'/>
<stylesheet src='stylesheet.css' />
<servlet path="/AuthenticationImpl" class="com.company.lorum.gwt.server.implementations.AuthenticationServiceImpl" />
<servlet path="/GeneralImpl" class="com.company.lorum.gwt.server.implementations.GeneralServiceImpl" />
<servlet path="/ProjectImpl" class="com.company.lorum.gwt.server.implementations.ProjectServiceImpl" />
</module>
- 我尝试继承我的css文件在欢迎文件html),其工作;但它不适用于我的小部件的样式规则。我不喜欢这种方法,因为不同的浏览器对css语法的行为不同。如果你知道我如何得到它的工作,我会使用它。这是我的Home.html来源
:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8"/>
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<title>lorum</title>
</head>
<body>
<script language="javascript" src="lorum/lorum.nocache.js"></script>
</body>
</html>
CSS(stylesheet.css)source(简单,因为我只想测试它是否有效):
CSS (stylesheet.css) source (its simple because I just want to test if it works):
.gwt-MenuBar {
color:green;
}
.gwt-Button {
font-size: 200%;
}
子问题:
我在哪里必须存储我的css文件为了我的lorum.gwt.xml文件检测和使用它使用以下语法:< stylesheet src ='stylesheet.css'/>
推荐答案
有两种简单的方法来包含CSS文件。
您可以在HTML中定义它,但是如果要覆盖已经采用的值,您必须在CSS属性的末尾使用!important标记。
There are two simple way to include a CSS-file. You can define it in the HTML but if you want to override a value which is already taken you have to use the !important tag at the end of your CSS-attribute.
或者你可以在你的名称中定义YourName.java
Or you can define it in you YourName.java
public interface CellTabelResources extends CellTable.Resources {
public interface CellTableStyle extends CellTable.Style {
};
@Source({ "style.css" })
CellTableStyle cellTableStyle();
}
这使得style.css变得最重要,所以它覆盖所有其他样式。
which make your style.css the most important so it overrides every other style.
这篇关于使用自定义css与gwt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!