Creating a parallel section? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Creating a parallel section?

How would I create a parallel section on my webpage if I have the code below where the div border width is 50% of page. So a similar section possibly different colour to the right. HTML <div>This is my test</div> CSS div { background-color: #c6bbed; border: 5px solid purple; width: 50%; height: 100%; }

14th Nov 2017, 11:25 PM
David Brady
David Brady - avatar
2 Answers
+ 3
Try this: body { margin: 0; padding: 0; } div { display: inline-block; background-color: #c6bbed; border: 5px solid purple; width: 50vw; height: 100vh; box-sizing: border-box; } div:nth-child(1) { margin-right: -1vw; } div:nth-child(2) { margin-left: -1vw; } // Since actual width cannot have exact 100vw, i use negative margin to adjust it. https://code.sololearn.com/WZgaVMM6YZ43/?ref=app
15th Nov 2017, 2:56 AM
Calviղ
Calviղ - avatar
+ 2
https://code.sololearn.com/WHPtdF6L0EgK/?ref=app something like that?
15th Nov 2017, 12:43 AM
Daniel
Daniel - avatar