Split column borders and gutters.
Tagged: background, border, gutter, split column
-
AuthorPosts
-
-
[email protected]
ParticipantIs there a way to style wpo split columns, so each of the two has its own border, background and a gutter running between them?
-
Chris F
KeymasterA simple way to do this is to use a 2-column row rather than split-column module. When using the row, you can select individual design elements for each column by using “Element CSS” rather than “Row CSS”.
Hope that helps. ;o)
-
[email protected]
ParticipantThanks for that Chris, but due to the page layout I want it 1/2, 1/4, 1/4 with borders, backgrounds and spaces (gutters?) between.
-
Chris F
KeymasterOK, we need some Bootstrap for that. Simply create a new row in your template, add a Custom HTML module, then add the following code to that:
<div class="container"> <div class="row"> <div class="col-sm-6 my-1"> <div style="border: 2px solid #f00; padding: 10px; background: #eee;"> 1/2 </div> </div> <div class="col-sm-3 my-1"> <div style="border: 2px solid #0f0; padding: 10px; background: #eee;"> 1/4 </div> </div> <div class="col-sm-3 my-1"> <div style="border: 2px solid #00f; padding: 10px; background: #eee;"> 1/4 </div> </div> </div> </div>
As you can see, I’ve designed each column individually by using inline CSS. You can also just create a class (if borders, backgrounds, etc. are the same), if you prefer.
Hope that helps. ;o)
-
-
[email protected]
ParticipantHi Chris. Thanks for that. It gives the desired styling effect. I had tried that originally (as I find my way through Bootstrap), but it wouldn’t stack on smaller screens, when I refreshed the webpage (not the wpo page) to check.
However the issue was of a different technical sort. I found that if closed the page and then re-opened it, the elements would now stack. A minor glitch and maybe one that may just be Chrome browser specific to my PC, but I thought I’d mention it.
p.s. What is the ‘my-1’ in <div class=”col-sm-6 my-1″> ?
-
Chris F
KeymasterHi Martin –
The my-1 is BS5 code for vertical margins:
m = margin
y = y-axis (i.e. vertical)
1 = size of margin (in em)This is the same as: style=”margin-top: 4px; margin-bottom: 4px;”
I added this to create a small margin (space between the sections) when shown in mobile view, so they don’t stack directly on top of each other without any space separating them.
You can learn more about BS5 margins/padding here:
https://getbootstrap.com/docs/5.1/utilities/spacing/#margin-and-paddingHope that helps. ;o)
-
-
[email protected]
ParticipantThanks Chris. I’m getting my head around this more now.
-