JQUERY Mobile - 样式H1 / span / div文本

时间:2011-12-06 20:09:58

标签: html css jquery-mobile

我有这个

<h1 id="coins"></h1>

但是当我使用Jquery Mobile时,不能用css来设置它吗?

.coins{
font-family: Verdana;
font-style: bold;
font-size: 50px;
color: #ecb502;
margin: 30px 30px 0px 0px;
}

还试过h1{}并没有帮助?

谁知道为什么?

2 个答案:

答案 0 :(得分:3)

如果你使用句号''为id设置样式。那是你的问题。样式 ids 带有'#'和类的哈希,带有句点'。'

此外,您将使用font-weight:bold而不是font-style。 font-style主要用于斜体。

而且,虽然它更像是一种偏好,但作为一个FYI,你不需要 来指定边距值为0的单位。零次任何事物仍为零,无关紧要。

答案 1 :(得分:0)

你只需要更具体地选择你的选择器,以便覆盖jQuery Mobile CSS(它将<h1>元素中的<div data-role="header">元素作为目标:.ui-header .ui-title):< / p>

变化:

.coins{

要:

/*this selects all elements that have both the `ui-title` and the `coins` classes and is a descendant of an element with the `ui-header` class*/
.ui-header .ui-title.coins{

请记住,具有最具体选择器的规则将在CSS中使用。

这是一个jsfiddle:http://jsfiddle.net/YdP7S/2/