how can i make so the vertical line starts in the first circle and ends with the height…
- User
how can i make so the vertical line starts in the first circle and ends with the height of the last item? hope it makes sense:
.job-entry:not(:last-child):before { content: ''; position: absolute; left: 319px; top: 349px; width: 1px; height: calc(100% - 540px); background-color: ; }
<div class="job-entry"> <p id="job-<?php echo $i;?>" class="mb-0"><span class="dot"></span><span class="fw-bold"><?php echo $position ?></span> - <span><?php echo $start_date ?> to <?php if ($end_date !== "") { echo $end_date; } else { echo "the present"; } ?></span></p> <p><span class="fw-bold"><?php echo $company ?></span>, <span><?php echo $location ?></span></p> </div> <?php $i++; }}?> - Assistant
To make a vertical line that starts at the first circle of your job entries and extends down to the bottom of the last job entry, you can modify the CSS pseudo-element you currently have (
.job-entry:not(:last-child):before) to ensure it covers the required height from the top of the first entry to the bottom of the last entry.Here's a possible approach to achieve that. You would use
:first-childfor the top position and:last-childfor the height of the parent element wrapping the job entries.-
Wrap job entries in a container: Make sure that your job entries are inside a parent container so you can position the vertical line correctly.
-
Modify the CSS: Make use of positioning to specify the start and end heights.
<div class="job-container"> <?php $i = 0; foreach ($jobs as $job) { ?> <div class="job-entry"> <p id="job-<?php echo $i;?>" class="mb-0"><span class="dot"></span><span class="fw-bold"><?php echo $position ?></span> - <span><?php echo $start_date ?> to <?php if ($end_date !== "") { echo $end_date; } else { echo "the present"; } ?></span></p> <p><span class="fw-bold"><?php echo $company ?></span>, <span><?php echo $location ?></span></p> </div> <?php $i++; }}?> </div>.job-container { position: relative; } .job-entry { position: relative; /* or absolute, depending on your layout */ } .job-container:before { content: ''; position: absolute; left: 20px; /* Adjust left position as needed */ top: 0; /* Start from the top of the first job entry */ bottom: 0; /* Extend down to the bottom of the last job entry */ width: 1px; background-color: <?php echo $color ?>; }Explanation:
- Container: The
.job-containerwraps all job entries and serves as a relative position reference for the vertical line. - Vertical Line: The
:beforepseudo-element on.job-containerstarts fromtop: 0(where the first job entry is) and goes tobottom: 0(where the last job entry is), causing the line to span the whole height of the container. - Styling: Adjust
leftandwidthattributes as per your layout needs.
Notes:
- Make sure to adjust the
leftproperty so that the line aligns properly with the circles or dots you have next to the entries. - Test and adapt according to the actual dimensions and structure of your specific layout as the heights may vary due to additional margins, paddings, or different screen sizes.
-
- User
now apply the same for this:
<?php if ($certifications_titles) { ?> <div id="certifications" class="ps-4 mb-4"> <?php $i = 0; if($certifications_titles) { foreach($certifications_titles as $certification_title) { $certificate = $certification_title['certificate']; $start_date = $certification_title['start_date']; $end_date = $certification_title['end_date']; $institution = $certification_title['institution']; $location = $certification_title['location']; ?> <div class="certification-entry"> <p id="education-title-<?php echo $i;?>" class="mb-0"><span class="dot"></span><span class="fw-bold"><?php echo $certificate ?></span> - <span><?php echo $start_date ?> a <?php echo $end_date ?></span></p> <p><span class="fw-bold"><?php echo $institution ?></span>, <span><?php echo $location ?></span></p> </div> <?php $i++; }}?> </div> <?php } ?> - Assistant
To create a vertical line for your certification entries similar to the job entries, you can follow a similar structure by wrapping the certification entries in a parent container and using CSS to position the line accordingly. Here's how you can do it:
HTML Structure
Wrap your certification entries in a container and ensure there’s a proper structure to accommodate the vertical line:
<?php if ($certifications_titles) { ?> <div id="certifications" class="ps-4 mb-4"> <div class="certification-container"> <?php $i = 0; if($certifications_titles) { foreach($certifications_titles as $certification_title) { $certificate = $certification_title['certificate']; $start_date = $certification_title['start_date']; $end_date = $certification_title['end_date']; $institution = $certification_title['institution']; $location = $certification_title['location']; ?> <div class="certification-entry"> <p id="education-title-<?php echo $i;?>" class="mb-0"><span class="dot"></span><span class="fw-bold"><?php echo $certificate ?></span> - <span><?php echo $start_date ?> a <?php echo $end_date ?></span></p> <p><span class="fw-bold"><?php echo $institution ?></span>, <span><?php echo $location ?></span></p> </div> <?php $i++; } } ?> </div> </div> <?php } ?>CSS Styles
Add CSS to handle the appearance of the vertical line:
.certification-container { position: relative; } .certification-entry { position: relative; /* Maintain this in case you need to style elements within */ } .certification-container:before { content: ''; position: absolute; left: 20px; /* Adjust left position as needed */ top: 0; /* Start from the top of the first certification entry */ bottom: 0; /* Extend down to the bottom of the last certification entry */ width: 1px; /* The thickness of the line */ background-color: <?php echo $color ?>; /* Use your PHP color variable */ }Explanation:
- Container: The
.certification-containerwraps all certification entries, making it the reference point for the vertical line. - Vertical Line: The
:beforepseudo-element is added to the.certification-container, withtop: 0to start at the top of the first entry andbottom: 0to stretch down to the bottom of the last entry. This ensures that the line visually connects all the certification entries. - Styling: Additionally, adjust the
leftproperty to ensure the line is aligned appropriately with the circles or dots next to the certifications.
Final Notes:
- Ensure that the
leftposition matches the layout of your application where the circles/dots are located. - As with the previous example, you might need to test and adjust according to the specific dimensions in your UI (like margins and paddings), especially if you introduce responsiveness to your design.
- Container: The