<img class='icon weather/mostlycloudy'
src="/fhem/images/default/weather/mostlycloudy.png" alt="mostlycloudy"
title="mostlycloudy">
我尝试过像
这样的事情[class~="weather"] {
witdh:50px;
}
.img.icon {
witdh:50px;
}
以及我能想象到的一切,但是如果我用chromes检查工具检查它,宽度属性永远不会出现。我确定我编辑了正确的.css文件,因为我可以看到该页面其他元素的影响。我当然不是html或css专家,也许有点笨......你能帮帮我吗?
答案 0 :(得分:1)
您的代码中有2个错误。
首先,选择器。 img是一个HTML元素,因此不应该以{{1}}作为前缀,因为它是一个类名。 (除非你有一个名为img的类。)
menuList = input('enter number:')
def printPackage(menuList):
if menuList == '1':
with open('menu/Menu1.txt')as f:
lines = []
for l_i, line in enumerate(f.read().split('\n'), 1): # Read the file and split it on newline. Enumerate the results returning index (l_i) and the line. Start l_i at 1
formatted_line = '%s. %s' % (l_i, line) # Format it with the line number.
print(formatted_line)
lines.append(formatted_line)
# If you want to save it.
with open('menu/Menu1_with_numbers.txt', 'w') as o_f:
o_f.write('\n'.join(lines)) # Join back the lines on newline and write it out to Menu1_with_numbers.txt
应该是:
.
第二次,您写了.img.icon {
而不是img.icon {
。您应该注意到,在检查员中,此属性已标记为witdh
,因为这是一个错误。
width
答案 1 :(得分:0)
img.icon
(选择img元素类型)而不是.img.icon
(查找包含class
的{{1}})应该可以解决问题。
如果您希望匹配以img
开头的任何课程,那么我建议weather/
。
答案 2 :(得分:0)
您无法使用&#34; /&#34;在班级名称。
<img class='icon weather mostlycloudy' ...>
img.weather {
witdh:50px;
}
答案 3 :(得分:-1)
img
是标记,所以你不要在它之前使用昏迷。 icon
是班级,因此在上课前你使用昏迷
img.icon
答案 4 :(得分:-1)
代码变化不大
[class~="weather"] {
width:50px;
}
img.icon {
width:50px;
}