![](/img/trans.png)
[英]how to display two divs side by side, left div with fixed position, right div having vertical scroll
[英]How to create an object to the right side of the div (div:left)
我们都知道伪类:before
和:after
但是没有nav ul li a:left
或:right
有可能实现这一目标吗? 我不介意为此使用html5,css3,javascript。
将:before
和:after
视为:left
和:right
。
:left
和:right
都不作为伪类存在,因此您应该使用:before
和:after
将其放置在所需对象的左侧和右侧。
div { margin: 0 auto; background: blue; width: 200px; } div:before { position: relative; left: -75px; background: red; content: 'To the left'; } div:after { position: relative; right: -75px; background: green; content: 'right'; }
<div>Some text</div>
回答问题
是否有可能实现额外的伪类?
没有。
如何达到此效果?
您将不得不使用其他元素并更改HTML以允许使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.