Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Social links profile using Flexbox

M 40

@mkalmetieva

Desktop design screenshot for the Social links profile coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


What challenges did you encounter, and how did you overcome them?

At first I used position: absolute, and the top of the page got cropped when zoomed in to a certain extent. Then I replaced position: absolute with Flexbox and the issue was gone; the page became more responsive.

Community feedback

@Yaqoob1410

Posted

In order to enhance the fidelity of our design implementation, let's focus on refining the spacing between text elements to better align with our intended layout. This can be achieved by fine-tuning the margin properties, particularly the 'margin-bottom' in 'rem' units, for each individual element. By meticulously adjusting these margins, we can ensure that the spacing throughout the design remains consistent and accurately reflects our desired aesthetic.

0

M 40

@mkalmetieva

Posted

Hi @Yaqoob1410! I set the vertical spacing between the links on the page by using gap: 1rem; property of Flexbox. In your opinion, are there any additional benefits of using margin-bottom compared to gap?

0

@Yaqoob1410

Posted

@mkalmetieva Both margin-bottom and gap (specifically in the context of CSS Grid and Flexbox) are useful for creating spacing between elements, but they have different use cases and benefits. Here are some additional benefits and distinctions between the two:

  1. Flexibility Across Layout Models: margin-bottom works in any layout context, including block, inline-block, and flexbox. It's not limited to just grid or flex containers.

  2. Consistent Spacing with Other Margins: Using margin-bottom can maintain consistency with other margins (top, left, right) applied to elements, making it easier to manage spacing throughout the layout.

  3. Individual Element Control: margin-bottom can be applied to individual elements, allowing for fine-grained control over spacing on a per-element basis.

  4. Layering and Overlapping: Margins allow for more nuanced control when elements might overlap or when you need specific spacing only in certain scenarios, which can be useful for complex layouts.

  1. Cleaner and Simpler Syntax: gap provides a cleaner and more concise syntax for defining space between items in a flex or grid container, eliminating the need for individual margins on each element.

  2. Consistent Spacing Between All Items: Using gap ensures uniform spacing between all direct children of the container, which is particularly useful for maintaining consistent row and column gaps in grid layouts or between flex items.

  3. Avoids Margin Collapse Issues: In block layouts, vertical margins between elements can collapse, which can sometimes cause unexpected results. gap avoids this issue entirely, as it doesn't involve margins.

  4. Inherent to Container: With gap, the spacing is a property of the container rather than the individual items, making it easier to adjust the overall layout spacing without modifying each item's margins.

  5. Support for Multi-Directional Spacing: In CSS Grid, gap (with row-gap and column-gap) allows for easy control over both horizontal and vertical spacing in a way that isn't as straightforward with margins.

  • Use margin-bottom when:

    • You need precise control over the spacing of individual elements.
    • You are working outside of a flex or grid context.
    • You want to apply different types of spacing (e.g., only horizontal or only vertical margins) that are not uniform.
  • Use gap when:

    • You want a straightforward way to control the spacing between items in a flex or grid container.
    • You need consistent spacing between all items in a container.
    • You want to avoid the potential complexities and pitfalls of margin collapse.

Both margin-bottom and gap have their place and choosing between them depends on the specific needs of your layout. gap simplifies spacing in grid and flex layouts, providing consistent and straightforward spacing control. On the other hand, margin-bottom offers more flexibility and control on an individual element basis and works across all layout models.

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord