我的HTML:
<tr class="footer">
<td colspan="6">
<div class="quicklinks">
<span class="footer_link">
<span class="new">
<a href="www.google.com">
<img title="mylink" src="" alt="mylink">My link</a>
</span>
</span>
</div>
</td>
和CSS:
a:link {
color: red;
}
a:hover {
color: green;
}
a:active {
color: green;
}
a:visited {
color: red;
}
a .footer_link {
color: blue;
}
这里是fiddle。如何通过.css将链接设为蓝色?什么是订单,无论我写入多少属性,如.footer .footer_link
它都不会变成蓝色。我也尝试了!important
,但没有改变。
提前致谢!
答案 0 :(得分:3)
你已经写好了。
您的css代码只需要一个核心:
.footer_link a {
color: blue;
}
在.footer_link类之后使用锚标记。
我已更新您的小提琴代码: http://jsfiddle.net/5omhc44L/1/
答案 1 :(得分:2)
像这样使用:使用后代选择器在footer_link
内定位锚标记。
您试图选择不存在的footer_link
内部锚点,因此使用a:link
样式规则。
a:link {
color: red;
}
a:hover {
color: green;
}
a:active {
color: green;
}
a:visited {
color: red;
}
.footer_link a {
color: blue;
}
&#13;
<tr class="footer">
<td colspan="6">
<div class="quicklinks">
<span class="footer_link">
<span class="new">
<a href="www.google.com">
<img title="mylink" src="" alt="mylink">My link</a>
</span>
</span>
</div>
</td>
&#13;
答案 2 :(得分:1)
由于您有a:link {
color: red;
}
只需在CSS中删除它。
a:link {
color: blue;
}
或改为
def main():
NumberofHouseholds = 0
inFile = open('program9.txt', 'r')
HouseIncome = []
global HouseIncome
avgincome = 0
lineRead = inFile.readline() # Read first record
while lineRead != '': # While there are more records
words = lineRead.split() # Split the records into substrings
acctNum = int(words[0]) # Convert first substring to integer
annualIncome = float(words[1]) # Convert second substring to float
members = int(words[2]) # Convert third substring to integer
global members
global annualIncome
print(acctNum, format(annualIncome, '.2f'), members, sep=' ')
HouseIncome.append(annualIncome)
povertycalc()
NumberofHouseholds = NumberofHouseholds + 1
avgincome = (avgincome+annualIncome)/NumberofHouseholds
lineRead = inFile.readline() # Read next record
# Close the file.
inFile.close() # Close file
print(avgincome)
print(HouseIncome)
def povertycalc():
indexKeep = []
global indexKeep
m = members
povertyLevel = 15930.00 + 4160.00 * (m-2)
if annualIncome < povertyLevel:
indexKeep.append(HouseIncome.index(HouseIncome[-1])) #Finds most recent index of household in HouseIncome and adds it to list indexKeep
print(indexKeep) #not printing the new value added to indexKeep
# Call the main function.
main()