DEV Community

Roger Campbell II
Roger Campbell II

Posted on

Blueprint: Navigating the UX to Code Handoff

Welcome to "Designers' Blueprint: Navigating the UX to Code Handoff." As a UI/UX designer, your role goes far beyond just crafting visually compelling designs. It's about forging creations that transition smoothly into live websites and applications. The journey from your design canvas to a functioning browser window is a crucial one, often riddled with challenges and nuances. This guide is thoughtfully curated to steer you through the pivotal steps of a seamless design-to-code transition.

Our roadmap will guide you through:

  1. Review your Figma mock-up to determine the best coding strategies and structural layout.
  2. Systematically organizing and preparing assets for development.
  3. Craft the foundational HTML structure to mirror your design layout.
  4. Establish the core styles that set the visual tone.
  5. Develop advanced layout styling techniques for a polished finish.

Each of these stages is a crucial pillar supporting a successful handoff. Ready to set forth on this enlightening expedition? Let's dive in!

Reviewing the Figma Document:

Before delving into the intricacies of code, it's pivotal to comprehensively review your Figma mock-up. Here's a systematic approach to ensure this phase is as effective as possible:

  1. Asset Check: Confirm that all visual assets – be it icons, images, or typography – are present and in the right formats. Organizing them in distinctively labeled folders or layers not only streamlines your workflow but also makes a developer's job easier.
  2. Layout Analysis: Examine the design layout meticulously. Grasp the essence of element flow, spacing, positioning, and alignment. This foundational understanding aids in both HTML and CSS strategy formulation.
  3. Naming Conventions: A well-structured Figma document is an ode to clarity. Adopt meaningful names for your layers and elements. For instance, rather than "Rectangle 5", opt for "Header Background." This ensures developers can effortlessly map design elements during the development phase.
  4. Notes and Annotations: Utilize Figma's comment feature to its full potential. Annotations on specific design nuances, hover states, or envisioned animations can prove invaluable. They act as a beacon, guiding developers in realizing your design vision to its fullest.
  5. Engage in a Walkthrough: Whenever feasible, conduct a session with your development team to elucidate your design. Direct interactions are potent mediums for ironing out ambiguities and achieving design-code congruence.

Diligent preparation at this initial phase sets the stage for a fluid transition through subsequent steps. With a clear design blueprint in hand, we're primed to navigate the intricacies of translating design into functional code. Let's dive in!

Download The Assets & Create Project Directory

The Figma for this walkthrough can be found here

Once you've reviewed and understood the Figma mock-up's design intent, the next step is to gather all necessary assets and set up your project workspace. Remember, an organized directory not only streamlines your workflow but also makes it easier for future collaborators or even your future self to understand the project structure.

CodeSandbox is an excellent platform for this purpose. It's an online editor tailored for web development, offering a live preview of your work as you build. If you're new to CodeSandbox or need a refresher:

  1. Start by visiting CodeSandbox's official website.
  2. Click on "Create Sandbox" and select the appropriate template. For our purposes, the "Vanilla" template, which offers a plain HTML, CSS, and JS environment, should suffice.
  3. Once your sandbox is ready, on the left panel, you'll find the src directory. This is where you'll be uploading your assets and creating necessary files.
  4. To add assets, simply drag and drop them into the src directory or right-click and choose "Upload Files."
  5. Create necessary folders within the src directory for better organization. For instance, you can have separate folders for images, styles, scripts, and so on.

For a more comprehensive walkthrough on leveraging CodeSandbox for your projects, I highly recommend this tutorial video which provides an in-depth look at its features and capabilities.

Add all the HTML and Introduce Elements

HTML, standing for HyperText Markup Language, serves as the backbone of any website or web application. It provides the essential structure, shaping the content to be displayed. Every webpage you've ever visited, from simple personal blogs to intricate e-commerce platforms, relies on this foundational layer. But what makes up this structure? Elements and tags.

An element in HTML consists of everything from the start tag to the end tag. It can contain text, and other elements, or be empty. The tags, which are angle-bracketed labels like <div>, <img>, or <h1>, denote the beginning and end of elements. Think of them as containers and labels that tell the browser what type of content is inside.

Let's explore this further.

Demo

Start with the most basic block of content, a div (division) tag. It's a container element:

<div>
</div>
Enter fullscreen mode Exit fullscreen mode

For headings, we use the h1 tag. It's typically reserved for main headings:

<h1>Roger Campbell II</h1>
Enter fullscreen mode Exit fullscreen mode

To add images, we utilize the img tag. Two crucial attributes are src and alt.

  • src (source) specifies the path to the image file. Be attentive to the directory structure; a wrong path will result in a broken link.
  • alt (alternative) provides a text description of the image, aiding accessibility and appearing in place of a broken image:
<img src="./assets/headshot-group.svg" alt="headshot of Roger Campbell II">
Enter fullscreen mode Exit fullscreen mode

To organize contact information or similar grouped content, wrapping them in a container, like a div, makes sense. For the sake of styling and structure, it's often useful to further wrap individual items inside their own div tags:

<div>
    <div>
        <img src="./assets/icons/web-icon.svg" alt="globe icon">
        <p>www.GemStack.io</p>
    </div>

    <div>
        <img src="./assets/icons/email-icon.svg" alt="email icon">
        <p>info@GemStack.io</p>
    </div>

    <div>
        <img src="./assets/icons/social-icon.svg" alt="social icon">
        <p>@MrRogerCampbell</p>
    </div>
</div>
Enter fullscreen mode Exit fullscreen mode

Lastly, if you wish to provide an interactive element like a button for users to take action:

<button>Schedule A Call</button>
Enter fullscreen mode Exit fullscreen mode

As you delve deeper into the world of HTML, always remember that it's about laying the foundational structure. It's the blueprint to which styles and interactivity will later be added.

Solution Code

<div>
  <h1>Roger Campbell II</h1>
  <img src="./assets/headshot-group.svg" alt="headshot of Roger Campbell II">

  <div>
    <div>
      <img src="./assets/icons/web-icon.svg" alt="globe icon">
      <p>www.GemStack.io</p>
    </div>

        <div>
          <img src="./assets/icons/email-icon.svg" alt="email icon">
          <p>info@GemStack.io</p>
      </div>

      <div>
          <img src="./assets/icons/social-icon.svg" alt="social icon">
          <p>@MrRogerCampbell</p>
      </div>
  </div>

  <button>Schedule A Call</button>

</div>
Enter fullscreen mode Exit fullscreen mode

Base Styles for the Site

Styling is where the design truly comes to life, transitioning from a static blueprint to a vibrant canvas that elicits emotions and actions. Cascading Style Sheets, or CSS, is the tool in our arsenal that allows us to achieve this transformation. Here, we'll delve into some foundational styles that form the essence of our design.

  1. Linking the CSS File: To utilize external styles, we first need to link our CSS file to our HTML. This is achieved through the link tag, placed within the head of the document.
<link rel="stylesheet" href="style.css">
Enter fullscreen mode Exit fullscreen mode
  1. Understanding CSS Selectors: CSS empowers us to target specific elements, or groups of elements, in our HTML for styling. Three primary selectors we'll explore are:
    • Tag Selectors: Targets all instances of a specific HTML tag.
    • Id Selectors: Targets a unique element assigned a specific id.
    • Class Selectors: Targets a group of elements that share a common class.
  2. Tag Selector Introduction:
/* Tag Selector */
body {
    background-color: black;
}
Enter fullscreen mode Exit fullscreen mode
  1. Id Selector Introduction: An id should be unique within the document, offering a pinpoint precision for styling.
<h1 id="persons-name">Roger Campbell II</h1>
Enter fullscreen mode Exit fullscreen mode
#persons-name {
    color: white;
}
Enter fullscreen mode Exit fullscreen mode
  1. Class Selector Introduction: Classes allow for broad but specific styling, which is especially beneficial when many elements share common stylistic traits.
<div>
    <div>
        <img class="icon-img" src="./assets/icons/web-icon.svg" alt="globe icon">
        <!-- ... -->
    </div>
    <!-- ... -->
</div>
Enter fullscreen mode Exit fullscreen mode
.icon-img {
    height: 43px;
    width: 43px;
}
Enter fullscreen mode Exit fullscreen mode
  1. Card Styling with Id Selectors: For enhanced aesthetics, we'll implement a background image to our card container and tweak some sizes.
<div id="card-container">
    <!-- ... -->
</div>
Enter fullscreen mode Exit fullscreen mode
#card-container {
    background-image: url("./assets/card-background-image.png");
    background-size: cover;
    width: 400px;
    height: 700px;
}
Enter fullscreen mode Exit fullscreen mode
  1. Headshot Styling:
<img id="headshot" src="./assets/headshot-group.svg" alt="headshot of Roger Campbell II">
Enter fullscreen mode Exit fullscreen mode
#headshot {
    width: 200px;
}
Enter fullscreen mode Exit fullscreen mode
  1. Contact Card Styling: A distinct container can elevate the appearance of contact details.
<div id="contact-container">
  <!-- ... -->
</div>
Enter fullscreen mode Exit fullscreen mode
#contact-container {
    background-color: #823483;
    width: 75%;
    border-radius: 10px;
}
Enter fullscreen mode Exit fullscreen mode
  1. Button Styling: Our final touch is the button, styled to draw attention and encourage user interaction.
<button id="schedule-button">Schedule A Call</button>
Enter fullscreen mode Exit fullscreen mode
#schedule-button {
    background-color: #48B83E;
    width: 75%;
    height: 75px;
    border-radius: 50px;
    color: white;
    font-size: x-large;
}
Enter fullscreen mode Exit fullscreen mode

As you progress, remember that CSS is not just about beauty; it's also about usability, accessibility, and enhancing the overall user experience. Happy styling!

Solution Code

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <!-- ... -->
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div id="card-container">
        <h1 id="persons-name">Roger Campbell II</h1>
        <img id="headshot" src="./assets/headshot-group.svg" alt="headshot of Roger Campbell II">

        <div id="contact-container">
            <div>
                <img class="icon-img" src="./assets/icons/web-icon.svg" alt="globe icon">
                <p>www.GemStack.io</p>
            </div>
            <div>
                <img class="icon-img" src="./assets/icons/email-icon.svg" alt="email icon">
                <p>info@GemStack.io</p>
            </div>
            <div>
                <img class="icon-img" src="./assets/icons/social-icon.svg" alt="social icon">
                <p>@MrRogerCampbell</p>
            </div>
        </div>

        <button id="schedule-button">Schedule A Call</button>
    </div>
</body>
</html>

Enter fullscreen mode Exit fullscreen mode

CSS

body {
    background-color: black;
}

#persons-name {
    color: white;
}

.icon-img {
    height: 43px;
    width: 43px;
}

#card-container {
    background-image: url("./assets/card-background-image.png");
    background-size: cover;
    width: 400px;
    height: 700px;
}

#headshot {
    width: 200px;
}

#contact-container {
    background-color: #823483;
    width: 75%;
    border-radius: 10px;
}

#schedule-button {
    background-color: #48B83E;
    width: 75%;
    height: 75px;
    border-radius: 50px;
    color: white;
    font-size: x-large;
}

Enter fullscreen mode Exit fullscreen mode

Intro Layout Styling

The final piece of the puzzle lies in layout styling, where we begin to witness the synergy between design and coding. At this juncture, we're not only presenting content but ensuring it's displayed in a manner consistent with our design intentions. Here, CSS FlexBox has become our most valuable tool. Let's dive into how it brings our design to life, centers our content, and streamlines our layout.

  1. Let's start by introducing CSS FlexBox and centering all the content inside our card-container div:
#card-container {
    /* ... */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
}
Enter fullscreen mode Exit fullscreen mode
  1. Next use FlexBox to handle the layout for the contact items:
    • We achieve this by:
      1. Adding a .contact-item class to each div surrounding our icons & contact info
      2. Adding flex to the CSS selector
      3. Updating the
    <div class="contact-item">
        <img class="icon-img" src="./assets/icons/web-icon.svg" alt="globe icon">
        <!-- ...  -->
    </div>

    <div class="contact-item">
        <img class="icon-img" src="./assets/icons/email-icon.svg" alt="email icon">
        <!-- ...  -->
    </div>

    <div class="contact-item">
        <img class="icon-img" src="./assets/icons/social-icon.svg" alt="social icon">
        <!-- ...  -->
    </div>
Enter fullscreen mode Exit fullscreen mode
.contact-item {
    color: white;
    display: flex;
    padding: 10px 20px;
}
Enter fullscreen mode Exit fullscreen mode
.icon-img {
    /* ... */
    margin-right: 20px;
}
Enter fullscreen mode Exit fullscreen mode

Conclusion

As we wrap up this guide, it's evident that the journey from design to code isn't just a linear progression. It's a dance between the beauty of design and the logic of code. Each step is carefully choreographed to ensure they move in harmony.

Through the steps laid out in "Designers' Blueprint: Navigating the UX to Code Handoff," you have experienced firsthand how design visions get translated into tangible, interactive elements on a web page. Remember, the bridge between design and development is not just about aesthetics or functionality in isolation but ensuring they seamlessly merge.

Whether you're a UI/UX designer or a budding web developer, always remember the importance of collaboration and understanding between both roles. It's in this partnership that truly incredible web experiences are crafted. As you move forward in your respective careers, let this guide be a foundation for many successful handoffs and beautifully executed projects.

Until the next journey, keep designing, keep coding, and keep collaborating. The web awaits your creativity and expertise.

Solution Code

HTML

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>HTML/CSS Intro</title>
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <div id="card-container">
        <h1 id="persons-name">Roger Campbell II</h1>

        <img id="headshot" src="./assets/headshot-group.svg" alt="Headshot of Roger" />

        <div id="contact-container">
            <div class="contact-item">
                <img class="icon-img" src="./assets/icons/web-icon.svg" alt="globe icon">
                <p>www.GemStack.io</p>
            </div>

            <div class="contact-item">
                <img class="icon-img" src="./assets/icons/email-icon.svg" alt="email icon">
                <p>Roger@GemStack.io</p>
            </div>

            <div class="contact-item">
                <img class="icon-img" src="./assets/icons/social-icon.svg" alt="social icon">
                <p>@MrRogerCampbell</p>
            </div>
        </div>

        <button id="schedule-button">Schedule A Call</button>
    </div>


</body>

</html>
Enter fullscreen mode Exit fullscreen mode

CSS

body {
    background-color: grey;
    color: white;
}

#card-container {
    background-image: url('./assets/card-background-image.png');
    background-size: cover;
    width: 400px;
    height: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
}

#persons-name {
    color: white;
}

#headshot {
    width: 200px;
}

#contact-container {
    background-color: #823483;
    border-radius: 10px;
    width: 75%;
}

#schedule-button {
    background-color: #48B83E;
    width: 75%;
    height: 75px;
    border-radius: 50px;
    color: white;
    font-size: x-large;
}

.icon-img {
    height: 43px;
    width: 43px;
    margin-right: 20px;
}

.contact-item {
    display: flex;
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)