微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使用calc获取此元素的当前高度?

如何解决如何使用calc获取此元素的当前高度?

我在另一个div内有一个div。

我想把里面的东西垂直放在中间。

我可以用这种方式实现它:

class SomeClass:
    def __init__(self):
        self.some_dict = defaultdict(lambda: None)

    def generate(self):
        <some code>

def some_method_to_parallelize(x: SomeClass):
    <some code>

def some_method():
    max_workers = round(os.cpu_count() // 1.5)
    invocations_per_process = 100
    with ProcesspoolExecutor(max_workers=max_workers) as executor:    
        data = [executor.submit(some_method_to_parallelize,SomeClass())] for _ in range(invocations_per_process)]
        data = list(itertools.chain.from_iterable([r.result() for r in data]))
    

但是,有时内盒的高度可变,因此我想使用以下内容

calc(50% - 100px ) /* if the height of the inside Box is 100px */

我尝试了许多方法,但无法成功。就像下面的图片一样。应该将其放置在两个厚实的笔尖之间的中间。

enter image description here

我可以知道如何在calc(50% - height ) calc(50% - attr(height) ) calc(50% - this(height) ) 函数中检索高度值吗?

更新:我根据jsotola的评论进行了尝试。但它表示该属性值无效。

enter image description here

谢谢

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。