.timeline{ min-width: 400px; position: relative; margin: 0 0 50px; &:before{ content: ''; width: 10px; height: 10px; position: absolute; background-color: black; top: 0; left: calc(50% - 6px); border-radius: 50%; z-index: 1; } } .post{ position: relative; display: flex; .head, .body{ position: relative; width: 50%; box-sizing: border-box; } .head { padding: 25px 20px; } .body { padding: 0 20px; } &.left{ flex-flow: row-reverse; .body{ text-align: right; } .head{ text-align: left; } .body:after{ content: ''; position: absolute; width: 12px; height: calc(100% - 98px); top: 98px; right: 0; background: url(/graphics/timeline-line.png) no-repeat right; background-size: 2px 100%; } .head:after{ content: ''; position: absolute; width: 12px; height: 98px; top: 0; left: -12px; background: url(/graphics/timeline-arrow-left.png) no-repeat; } } &.right{ flex-flow: row; .body{ text-align: left; } .head{ text-align: right; margin: 0 10px; } .body:after{ content: ''; position: absolute; width: 100px; height: calc(100% - 98px); top: 98px; left: -12px; background: url(/graphics/timeline-line.png) no-repeat; background-size: 2px 100%; } .head:after{ content: ''; position: absolute; width: 12px; height: 98px; top: 0; left: calc(100% - 2px); background: url(/graphics/timeline-arrow-right.png) no-repeat; } } } @media screen and (max-device-width: 400px) { .timeline { min-width: 0; position: relative; margin: 0 0 50px; .head{ margin: 0; padding: 0; } .body{ margin: 0 0 40px; padding: 0; } .body p{ text-align: left; margin: 0 0 2px; padding: 0; } .post { position: relative; display: flex; .head, .body { position: relative; width: 90%; box-sizing: border-box; } &.left { display: block; .body:after, .head:after { background: none; } } &.right { display: block; .body:after, .head:after { background: none; } } &.left .head { text-align: left; } &.right .head { text-align: left; } .head { padding: 5px 20px; } .body { padding: 0 20px; } } } }