我想更改在 div 中找到的几个 rss 链接的字体大小
<div class="rss">
<%
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document d = db.parse("http://www.engadget.com/rss.xml");
d.getDocumentElement().normalize();
NodeList items = d.getElementsByTagName("item");
for(int y = 0 ; y< 5 ; y++)
{
String title = "", description = "" , link = "";
NodeList subitems = (items.item(y)).getChildNodes();
for(int x = 0 ; x< subitems.getLength() ; x++)
{
if(subitems.item(x).getNodeType() == Element.ELEMENT_NODE)
{
if(subitems.item(x).getNodeName().equals("title")&& title.isEmpty())
{
title = subitems.item(x).getTextContent();
} else
if(subitems.item(x).getNodeName().equalsIgnoreCase("link") && link.isEmpty())
{
link = subitems.item(x).getTextContent();
} else
if(subitems.item(x).getNodeName().equals("description") && description.isEmpty())
{
description = subitems.item(x).getTextContent();
}
}
if(!description.isEmpty()&&!link.isEmpty()&&!title.isEmpty())
{
%>
<a href="<%=link%>"><%=title%></a>
<br/>
<%
break;
}
}
}
%>
</div>
从css文件我试过这个:
.rss
{
font-size: x-small;
}
但后来我注意到这个 css 可能正在覆盖它:
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, p, blockquote, th, td { margin: 0; padding: 0; font-size: 14px; direction: ltr; }
p { font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; font-weight: normal; font-size: 14px; line-height: 1.6; margin-bottom: 17px; }
p.lead { font-size: 17.5px; line-height: 1.6; margin-bottom: 17px; }
所以我也尝试添加:
div.rss{
font-size: xx-small;
}
还是行不通。
我该怎么做才能使这些链接变小?