Changes for page Home
Last modified by Alex Cotiugă on 2026/01/13 13:12
From version 7.133
edited by Alex Cotiugă
on 2025/11/17 09:07
on 2025/11/17 09:07
Change comment:
There is no comment for this version
To version 7.145
edited by Alex Cotiugă
on 2025/11/17 09:32
on 2025/11/17 09:32
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -109,9 +109,17 @@ 109 109 <p class="lead"> 110 110 All the XWiki services you need, delivered with precision and care 111 111 </p> 112 + 113 + #set ($servicesSize = $servicesSectionData.size()) 112 112 <div class="services-grid"> 113 113 #foreach ($entry in $servicesSectionData) 114 - <article class="service"> 116 + #set ($classes = "service") 117 + ## If this is the last item AND the total number is odd, center it 118 + #if ($foreach.count == $servicesSize && ($servicesSize % 2) == 1) 119 + #set ($classes = "service service-center") 120 + #end 121 + 122 + <article class="$classes"> 115 115 <div class="service-icon"> 116 116 <i class="fa fa-$entry.icon" aria-hidden="true"></i> 117 117 </div>
- XWiki.StyleSheetExtension[0]
-
- Code
-
... ... @@ -35,8 +35,11 @@ 35 35 36 36 .lead { 37 37 color: @muted; 38 - max-width:72ch;38 + text-align: center; 39 39 } 40 + h2 { 41 + text-align: center; 42 + } 40 40 41 41 section { 42 42 padding: 32px 0; ... ... @@ -186,7 +186,13 @@ 186 186 margin-top: 20px; 187 187 display: flex; 188 188 flex-wrap: wrap; 189 - gap: 24px; // space between items 192 + gap: 24px; 193 + 194 + /* center the whole block under the heading */ 195 + max-width: 960px; // tweak 900–1040px to taste 196 + margin-left: auto; 197 + margin-right: auto; 198 + justify-content: center; 190 190 } 191 191 192 192 .service { ... ... @@ -195,7 +195,7 @@ 195 195 display: flex; 196 196 align-items: flex-start; 197 197 gap: 16px; 198 - margin-bottom: 8px; // extra vertical breathing room207 + margin-bottom: 8px; 199 199 200 200 .service-icon { 201 201 width: 42px; ... ... @@ -238,11 +238,9 @@ 238 238 } 239 239 } 240 240 241 - /* Center the last item when odd: 242 - auto margins in a flex row push it to the middle */ 250 + /* Last item when count is odd: full-width on its own row */ 243 243 .service-center { 244 - margin-left: auto; 245 - margin-right: auto; 252 + flex: 0 1 100%; 246 246 } 247 247 248 248 /* Mobile: 1 per row */ ... ... @@ -249,14 +249,13 @@ 249 249 @media (max-width: 767px) { 250 250 .services-grid { 251 251 gap: 16px; 259 + max-width: 100%; 252 252 } 253 - .service { 261 + 262 + .service, 263 + .service-center { 254 254 flex: 0 1 100%; 255 255 } 256 - .service--center { 257 - margin-left: 0; 258 - margin-right: 0; 259 - } 260 260 } 261 261 } 262 262