我还是CSS的新手,所以如果这个问题听起来很初级(确实如此),请原谅。长话短说,我目前正在为我的学校开发一个Ning社交网络中心,足以说明,拥有一个预制的、预制的设置对于真正的定制来说并不是很理想。我已经设置了一个背景图像的主页,我希望该主页上的所有链接(所有指向同一网络上的不同页面)也以该背景图像为特色。我可以使用主页上的CSS框来突出那个背景图像,但我始终想不出一种方法来对任何一个子页链接做同样的事情。我尝试添加和更改他们的it,但这只会导致添加一个div到他们,而不是确切的背景变化,当你实际点击链接并转到那个页面时。这并不是那么复杂,我知道我错过了一些基本的东西。有人能帮上忙吗?
这是我的“主页”的html代码:
<p><span class="font-size-3" style="color: #000000;"><strong><strong>1. <a href="http://pharmacypeertopeeradvising.ning.com/page/healtheast-st-john-s-hospital-2012-2013-reviews" target="_self" id="AcuteCareAPPE">HealthEast St.John's Hospital, Maplewood</a></strong></strong></span></p>
<p><span class="font-size-3" style="color: #000000;"><strong><strong>2. <a href="http://pharmacypeertopeeradvising.ning.com/page/fairview-university-of-minnesota-medical-center-minneapolis-2012-" target="_self" id="AcuteCareAPPE">Fairview UMMC, Minneapolis</a></strong></strong></span></p>
<p><span class="font-size-3" style="color: #000000;"><strong><strong>3. <a href="http://pharmacypeertopeeradvising.ning.com/page/park-nicollet-methodist-hospital-minneapolis-2012-2013-reviews" target="_self" id="AcuteCareAPPE">Park Nicollet Methodist Hospital, St. Louis Park</a></strong></strong></span></p>
<p><span class="font-size-3" style="color: #000000;"><strong>4. </strong></span><span class="font-size-3" style="color: #000000;"><strong><a href="http://pharmacypeertopeeradvising.ning.com/page/united-hospital-allina-2012-2013-reviews" target="_self" id="AcuteCareAPPE">Allina United Hospital, St. Paul</a></strong></span></p>
<p><span class="font-size-3" style="color: #000000;"><strong>5. <a href="http://pharmacypeertopeeradvising.ning.com/page/regions-hospital-level-1-trauma-center-st-paul" target="_self" id="AcuteCareAPPE" name="AcuteCareAPPE">HealthPartners Regions Hospital-Level 1 Trauma Center, St. Paul</a></strong></span></p> 这是我得到的CSS代码。因为它是NING网络,CSS被放在“主页”底部的“盒子”上:
<style>
#AcuteCareAPPE{
background-image:url(http://www.acutecarecontinuum.com/Portals/0/IMG_3192_ver2.jpg);
background-position: -50px, +10px;
}
</style>所以您可以看到,我试图使到这4个页面的链接(都具有相同的ID为AcuteCareAPPE)具有相同的背景,但是我的CSS代码最终返回了这些链接周围的背景图像的div。我接下来该怎么办?
发布于 2013-09-28 05:11:15
请改用类。每页允许一个id。我不确定你到底想做什么,但是如果你解释一下在这个代码链接中应该发生什么,我可以帮助你。我更新了你的代码,改为使用无序列表。http://codepen.io/anon/pen/aJhBl
https://stackoverflow.com/questions/19059430
复制相似问题