Reputation: 8423
I currently have a code that splits screen into 4 equal parts and it works, but I also want a 1px line that crosses the screen horizontally and vertically. Anybody has an idea how to make it happen?
CSS:
#NW { position:fixed; width:50%; height:50%; top:0; left:0; background:orange }
#NE { position:fixed; width:50%; height:50%; top:0; left:50%; background:blue }
#SW { position:fixed; width:50%; height:50%; top:50%; left:0; background:green }
#SE { position:fixed; width:50%; height:50%; top:50%; left:50%; background:red }
html:
<div id="NW"></div>
<div id="NE"></div>
<div id="SW"></div>
<div id="SE"></div>
Thank you!
Upvotes: 0
Views: 3188
Reputation: 208012
Add:
#SE, #SW {
border-top:1px solid white;
}
#NE, #SE {
border-left:1px solid white;
}
Upvotes: 3
Reputation: 1055
You could mess around with left and right borders for the existing divs.
Example:
#NW {
border-right: 1px black solid;
border-bottom: 1px black solid;
}
#NE {
border-left: 1px black solid;
border-bottom: 1px black solid;
}
#SW {
border-right: 1px black solid;
}
#SE {
border-left: 1px black solid;
}
I'm not sure I would set height/width with percentage when trying to add borders - might lead to overflow problems. Otherwise, this should work!
Upvotes: 1