Reducing vertical space between two specific questions (using JavaScript) | Experience Community
Skip to main content
Question

Reducing vertical space between two specific questions (using JavaScript)

  • February 26, 2026
  • 2 replies
  • 22 views

gPandey_715
Level 4 ●●●●
Forum|alt.badge.img+9

Hi everyone,

I’m trying to reduce the vertical space between two specific questions in a branded theme survey.

I only want the spacing reduced for one question (not globally via Look & Feel).

Has anyone implemented a reliable way to reduce spacing between two specific questions using JavaScript (without affecting the entire survey)?

Any guidance would be greatly appreciated. ​@vgayraud 

 

 

2 replies

vgayraud
QPN Level 7 ●●●●●●●
Forum|alt.badge.img+61
  • QPN Level 7 ●●●●●●●
  • February 26, 2026

Hi,

I don’t know enough about your custom theme to answer with certainty, but try something like this.

Qualtrics.SurveyEngine.addOnReady(function() {

var questionContainer = this.getQuestionContainer();
questionContainer.style.paddingBottom = "0px";

});

If not working, identify and select the elements you need to adapt in a similar way.


KelliPolk
Level 3 ●●●
Forum|alt.badge.img+19
  • Level 3 ●●●
  • February 26, 2026

If you are using the New Survey Taking Experience, you can go into Look and Feel. Under Style edit your custom CCS. Here is what I have currently for one of my surveys:

 

/* Global spacing for questions */

section.question {

  margin: 5px 0 !important;

  padding: 5px 0 !important;

}

 

/* Remove padding/margin around error wrapper */

.question-error-wrapper {

  padding: 0 !important;

  margin: 0 !important;

}

 

/* Layout QID10, QID71, QID72 side by side */

#question-QID10,

#question-QID71,

#question-QID72 {

  display: inline-block;

  vertical-align: top;

  width: 50%;

  margin-right: 1.5%;

  margin-bottom: 0 !important;

  box-sizing: border-box;

}

 

/* QID72 narrower (e.g., Preferred Name) */

#question-QID6 {

  width: 20%;

}

 

/* Remove margin from last in row */

#question-QID72 {

  margin-right: 0;

}

 

/* Stack QID10, 71, 72 on smaller screens */

@media screen and (max-width: 880px) {

  #question-QID10,

  #question-QID71,

  #question-QID72 {

    display: block;

    width: 100%;

    margin-right: 0;

    margin-bottom: 20px;

  }

}

 

/* Add spacing below certain questions */

#question-QID73,

#question-QID13 {

  margin-bottom: 40px !important;

}

 

/* Layout QID73 and QID13 side by side */

#question-QID73,

#question-QID13 {

  display: inline-block;

  vertical-align: top;

  width: 50%;

  margin-right: 1.5%;

  margin-bottom: 0 !important;

  box-sizing: border-box;

}

 

/* Stack QID73 and QID13 on smaller screens */

@media screen and (max-width: 880px) {

  #question-QID73,

  #question-QID13 {

    display: block;

    width: 100%;

    margin-right: 0;

    margin-bottom: 20px;

  }

}

 

/* Layout QID70 and QID12 side by side */

#question-QID70,

#question-QID12,

#question-QID14 {

  display: inline-block;

  vertical-align: top;

  width: 40%;

  margin-right: 1.5%;

  margin-bottom: 0 !important;

  box-sizing: border-box;

}

 

/* Stack QID70, QID14, QID12 on small screens */

@media screen and (max-width: 880px) {

  #question-QID70,

  #question-QID12,

  #question-QID14 {

    display: block !important;

    width: 100% !important;

    margin-right: 0 !important;

    margin-bottom: 20px !important;

  }

}

 

/* Add spacing below certain questions */

#question-QID70,

#question-QID12 {

  margin-bottom: 40px !important;

}

Let me know if you need help modifying it for your specific use case. 

 

KP