简体   繁体   English

我希望元素的大小根据其旁边的元素在屏幕上占据多少空间而减小

[英]I want element to decrease in size based how much space does the element next to it take space on the screen

So I want the divider line on the picture to decrease or increase in size based on the All publications link. 因此,我希望基于“所有出版物”链接来缩小或增加图片上的分隔线。 Currently I have done it like this, but I'm wondering if there's a better solution for this? 目前,我已经这样做了,但是我想知道是否有更好的解决方案?

在此处输入图片说明

@media (max-width: 767px) {

    .dividing .col-xs-6 {
        width:75%;
    }
}
@media (max-width: 600px) {

    .dividing .col-xs-6 {
        width:65%;
    }
}

@media (max-width: 423px) {

    .dividing .col-xs-6 {
        width:55%;
    }
}

You could use a :before element: 您可以使用:before元素:

 h2{ margin: auto; margin-top: 2em; text-align: right; display: flex; align-items: center; color: #34495e; padding-bottom: 1em; } h2:before{ content: ''; flex: 1 0 0; margin-right: 0.25em; height: 2px; background: #34495e; } 
 <h2><a href="http://stackoverflow.com">Test</a></h2> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM