|
1 | 1 | <?php |
2 | 2 | /** |
3 | | - * Template for displaying a board member in a side-by-side layout |
4 | | - * where the left column (header) is sticky and only the right column scrolls. |
| 3 | + * Template for displaying a board member in a side-by-side layout: |
| 4 | + * Left column (header) is 30% wide and sticky; right column is 70% wide. |
5 | 5 | * |
6 | 6 | * @package osi |
7 | 7 | */ |
8 | 8 | ?> |
9 | 9 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
10 | 10 | <div class="board-member-wrapper"> |
11 | 11 |
|
12 | | - <!-- Left Column: Sticky CPT Header --> |
| 12 | + <!-- LEFT COLUMN: Sticky CPT Header (30% width) --> |
13 | 13 | <div class="board-member-header"> |
14 | 14 | <?php get_template_part( 'template-parts/header-board-member' ); ?> |
15 | 15 | </div> |
16 | 16 |
|
17 | | - <!-- Right Column: Scrollable Content --> |
| 17 | + <!-- RIGHT COLUMN: Main Content (70% width, scrolls normally) --> |
18 | 18 | <div class="board-member-content"> |
19 | 19 | <div class="entry-content post--content"> |
20 | 20 | <?php the_content(); ?> |
|
24 | 24 | <?php // get_template_part( 'template-parts/nav-postname-pager' ); ?> |
25 | 25 | <?php // get_template_part( 'template-parts/email-block' ); ?> |
26 | 26 | </section> |
27 | | - </div> |
| 27 | + </div><!-- .board-member-content --> |
28 | 28 | </div><!-- .board-member-wrapper --> |
29 | 29 | </article> |
30 | 30 |
|
31 | 31 | <style> |
32 | 32 | /* |
33 | | - 1) We make a flex container for the two columns. |
34 | | - 2) The left column is "sticky" so it stays pinned below the site header. |
35 | | - 3) The right column scrolls normally. |
| 33 | + The container for both columns: |
| 34 | + - We use flex to lay out the left and right columns. |
| 35 | + - We leave some gap if needed. |
36 | 36 | */ |
37 | | - |
38 | 37 | .board-member-wrapper { |
39 | 38 | display: flex; |
40 | | - align-items: flex-start; /* So columns top-align */ |
41 | | - gap: 20px; /* optional spacing between columns */ |
| 39 | + align-items: flex-start; /* So columns align at the top */ |
| 40 | + gap: 0; /* adjust as desired */ |
42 | 41 | } |
43 | 42 |
|
44 | | -/* LEFT COLUMN: Sticky */ |
| 43 | +/* LEFT COLUMN: 30% width, sticky under the site header */ |
45 | 44 | .board-member-header { |
46 | | - position: sticky; |
47 | | - top: 120px; /* adjust to your site header’s height */ |
48 | | - flex-shrink: 0; /* so it doesn’t shrink */ |
49 | | - width: 350px; /* pick any suitable width */ |
50 | | - background-color: #fff; |
51 | | - padding: 20px; |
| 45 | + position: sticky; |
| 46 | + top: 120px; /* match this to your site header height so there's no overlap */ |
| 47 | + width: 30%; |
| 48 | + flex-shrink: 0; /* prevents the left column from shrinking */ |
52 | 49 | box-sizing: border-box; |
53 | 50 | } |
54 | 51 |
|
55 | | -/* RIGHT COLUMN: Normal Flow, Fills Remaining Space */ |
| 52 | +/* RIGHT COLUMN: 70% width, scrolls normally */ |
56 | 53 | .board-member-content { |
57 | | - flex: 1; |
| 54 | + width: 70%; |
58 | 55 | padding: 20px; |
59 | 56 | box-sizing: border-box; |
60 | 57 | } |
|
0 commit comments