html - CSS变换旋转问题

标签 html css twitter-bootstrap progress-bar timeline

我们的团队正在 ServiceNow 的服务门户中构建一个时间轴小部件,并且在尝试使时间轴响应时遇到了一些 CSS 问题。我们使用水平的 Bootstrap 进度条拼凑了一个时间轴。当屏幕尺寸减小时,我们希望水平进度条变为垂直。我们通过 transform: rotate(-270deg) 实现了这一点,但它没有正确居中和缩放,而且大部分时间线实际上不在屏幕上:

enter image description here

我们通过增加一些边距解决了这个问题,但正在尝试找出是否有更好的方法来做到这一点:

#timeline-wrap{
  top:100px;
  position:relative;
}

@media screen and (max-width: 768px) {
  #timeline-wrap{
    margin-top: 35%;
    margin-left: 5%;
    margin-right: 5%;
    transform: rotate(-270deg);
  }
}

使用上面的 CSS,这是它在较小屏幕尺寸下的样子:

enter image description here

最佳答案

试试这个:

#timeline-wrap{
        position:relative;
    }

    @media screen and (max-width: 768px) {
        #timeline-wrap{
            margin-top:50vh !important;
            margin-left:auto;
            margin-right:auto;
            transform: rotate(-270deg);
            width:70vh;
        }
    }

Demo here

关于html - CSS变换旋转问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57046892/

相关文章:

javascript - JQuery .toggle ('Slide' ) 没有显示我的内容

html - 将一个 div 自动放入另一个

javascript - 我怎样才能拥有能够扩展一行中所有列的 Bootstrap 文本区域

css - 如何将 margin-top 添加到 bootstrap col/form 中的超链接?

html - CSS 动画 - 无限动画重新启动时有延迟

html - CSS3 跳跃位置

html - 向下移动悬停背景和字体

html - 如何在 Bootstrap 3 中重新排序行

html - 固定位置 div 内的 CSS 垂直对齐

android - Bootstrap 3 在移动设备上添加右边距(?)