在这个小提琴中:How to Use QSettings,我正在尝试使用悬停选择器来显示工具提示但无法使其工作。
import math
class shape(object):
"""Shape is an base class, which is largely intended to be abstract, that
is only used as a parent class to other classes wich define specific shapes
and inherit the shape class' fuctions getArea() and printArea().
"""
def __init__(self):
'''constructor function for the shape class
'''
self.area = None
self.name = "shape"
def getArea(self):
'''returns the area of the shape, which is defined in the constructor
'''
return self.area
def printArea(self):
'''prints a statement identifying the shape by its name and giving the
area of the shape. Returns None.
'''
print "The area of this " + self.name + " is: " + str(self.area)
return None
如何引用二级div,以便显示工具提示div?
答案 0 :(得分:3)
组合子~
和+
仅适用于兄弟元素。
因此它无效,因为.ic-token
不是具有该div
元素的兄弟元素。由于您无法在CSS中选择父元素,因此目前无法实现。
最接近的是:
#typeahead-box:hover .ic-tokens + div #tooltip {
display: block
}
答案 1 :(得分:1)
.ic-tokens:nth-child(2){}
这将获得ic-tokens类的第二个孩子。尽管如此,这是一种愚蠢的方式。如果我是你,我会用JS来做这件事。