如何使用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 (将#修改为@)