Update Custom Branding Elements | Yext Hitchhikers Platform

What You’ll Learn

By the end of this unit, you will be able to:

  • Navigate and make edits to the answers.scss file
  • Identify when to use the answers.scss file over the answers-variables.scss file
  • Find examples of custom styling in the Search reference documentation


Features or components outside of the standard branding elements we discussed in the previous unit are referred to as custom elements. When creating custom styling, it will often be updates to a single class rather than bulk styling updates (e.g., updating the color of one CTA instead of all CTAs in a search experience).

Any custom styling you want to add can be placed in the static > scss > answers.scss. It’s important that you keep any custom styling (unless otherwise noted in the modules) in this file. This will allow you an easy, singular place to find any customizations you’ve made to your Search experience, which will make it easier when editing or upgrading your site.

When you open the file on a new site, you’ll see the below:

  // insert Answers scss here e.g.
  //&-nav {
  //  padding-top: 32px;

Place any styling within the Answers class. This will keep it scoped to the components of the pages. Remember, to determine the class names of the elements you want to target, you can inspect the page in question.

In this file, you can also customize features that are defined within the answers-variables.scss file. For example, updating the --yxt-results-title-text-color variable in answers-variables.scss to red will make the title bar for every vertical results on the universal search page turn red. However, if you want each vertical to be a different color, you can update the class for each title separately within the answers.scss file instead. This would look something like:

.HitchhikerResultsStandard--help_articles {
  .HitchhikerResultsStandard-title {
    background-color: red;

Custom coloring for a single vertical results title bar

To see examples of custom styling, see the Custom Code Styling Snippets section of the reference docs.

light bulb

Try to use the variables you define in answers-variables.scss (which you learned about in the last unit) as much as possible in the custom CSS in answers.scss. This will reduce redundancy in your code, and make it easier if you ever need to change the value of that variable across all style rules it’s used in.

You should also try to use the default styling as much as possible - these reflect our best practices that have been user-tested and account for accessibility and browser/device compatibility.

unit Quiz
+20 points
Daily Quiz Streak Daily Quiz Streak: 0
Quiz Accuracy Streak Quiz Accuracy Streak: 0
    Error Success Question 1 of 3

    According to our best practices, which files should you add custom Search-specific SCSS rules to?

    Error Success Question 2 of 3

    Can you use variables defined in answers-variables.scss in your answers.scss rules?

    Error Success Question 3 of 3

    You want to edit the background color of all CTAs on a specific vertical. Which file would you add this styling to?

    Wahoo - you did it! 🙌

    You've already completed this quiz, so you can't earn more points.You completed this quiz in 1 attempt and earned 0 points! Feel free to review your answers and move on when you're ready.
1st attempt
0 incorrect