Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Rich Text Editor available in the Field Label and other locations in REDCap provides point and click menu functionality to change the formatting of fields and surveys.  The variety of fonts, sizes, colors and other functionality, however, are limited.

REDCap allows the use of some HTML and CSS in the Field Labels, Field Notes, Multiple Choice coding, and other locations.  HTML and CSS allows access to a wide variety of functionality to change the look and feel of surveys.  For example, here is a full list of named colors you can access!

Some basic information about HTML:

  • HTML works by enclosing the text you want to format with HTML "tags".
  • The tags can be included in your Section, Descriptive, Question and/or Answer texts.
  • A tag is a type of instruction or command that will change the appearance of text as well as perform other functions on your REDCap forms because they are web pages.
  • The tags are enclosed with greater and less than < brackets > and may be written in capital and lower case letters.
  • You need to both open a tag and close it.
  • You close it with the same tag but add a /

Example < center > centering text < /center >. *Do not leave spaces in tags when using the actual tag - see below for examples.

The REDCap rich text editor allows you to change

Check out this example survey for formatting ideas: https://redcap.vanderbilt.edu/surveys/?s=JA3AXMHYC7

W3 Schools also has great resources for HTML and CSS

Styles of Fonts with HTML

You can style your fonts in three basic ways:

Bold face font, Italics font, and bold&italics font together. 

Bold Face

To make a format bold you will have to use this HTML code:

Code Block
languagehtml/xml
themeConfluence
titleThe HTML Code Bold
<strong>This text is bold.</strong>

...


When you use the HTML code, <strong>Insert text here.</strong> , this will be produced. 

Panel
borderColorgray
bgColorazur
titleColorblack
borderWidth1
titleBGColorlemonchiffon
borderStylesolid
titleBrowser Results Bold


Html bobswift
<strong>This text is bold.</strong>


Italics Font 

To make a format italics you will use this HTML code:

Code Block
languagehtml/xml
themeEclipse
titleHTML Code Italics
<em>Do this and your text will be in italics style.</em>

...


When you use the HTML Code, <em>Insert text here.</em>, this will be produced.

Panel
borderColorgrey
bgColorazul
titleColorblack
titleBGColorlemonchiffon
borderStylesolid
titleBrowser Results Italics


Html bobswift
<em>Do this and your text will be in italics style.</em>

...



Bold and Italics 

To make a format italics and bold, you will use the HTML code:

Code Block
languagehtml/xml
themeConfluence
titleHTML Code Bold and Italic
<strong><em>To get your text italics and bold, do this.</em></strong>

...


When you use the HTML Code, <strong><em>Insert text here.</em></strong>, this will be produced. 

Panel
borderColorgrey
bgColorazul
titleColorblack
titleBGColorlemonchiffon
borderStylesolid
titleBrowser Results Italics&Bold


Html bobswift
<strong><em>To get your text italics and bold, do this.</em></strong>


Font Colors and Sizes with HTML

Another couple of different simple formatting options you can do in REDCap surveys or forms is having different font colors and font sizes.

...

All you have to do is use/copy these HTML Codes: 

Font Colors 

To make a words in REDCap have font colors, use this HTML code:

Code Block
languagehtml/xml
themeConfluence
titleHTML Code Font Color
<font color="red">This color will be red.</font>
<font color="purple">This color will be purple.</font>
<font color="green">This color will be green.</font>
<font color="blue">This color will be blue.</font>

 


When you use the HTML code <font color="any color">Insert text here.</font>, you can get any color you want with the font.  Here is a full list of named colors.

Panel
borderColorgrey
bgColorazul
titleColorblack
titleBGColorlemonchiffon
borderStylesolid
titleBrowser Results Font Color


Html bobswift
<font color="red">This color will be red.</font> 
<font color="purple">This color will be purple.</font>
<font color="green">This color will be green.</font>
<font color="blue">This color will be blue.</font>

...



Font Sizes

For different font sizes, use this HTML code: 

Code Block
languagehtml/xml
themeConfluence
titleHTML Code Font Sizes
<div style="font-size: 10pt">This is how you change the size of the font.</div>
<div style="font-size: 14pt">This is how you change the size of the font.</div>
<div style="font-size: 20pt">This is how you change the size of the font.</div>
<div style="font-size: 22pt">This is how you change the size of the font.</div> 

 


When you use the HTML code <font size="any number">Insert text here.</font>, you can get any 

Panel
borderColorgrey
bgColorazul
titleColorblack
titleBGColorlemonchiffon
borderStylesolid
titleBrowser Results Font Sizes


Html bobswift
<div style="font-size: 10pt">This is how you change the size of the font.</div>
 
<div style="font-size: 14pt">This is how you change the size of the font.</div>
 
<div style="font-size: 20pt">This is how you change the size of the font.</div>
 
<div style="font-size: 22pt">This is how you change the size of the font.</div> 
 

 

 

 

 

 

 

 

 

Font Color & Sizes

For combining both font color & sizes, use this HTML code: 

Code Block
languagehtml/xml
themeConfluence
titleHTML Code Font Sizes
<p style="font-weight:normal;">Here is a selection of text styles:</p> 

<p style="color:red; font-size:75%;">small and red</p> 

<p style="color:green; font-weight:bold; font-size:150%;">bold, large and green</p> 

<p style="color:blue; font-family: monospace;">blue monospace</p> 

<p style="display:block; padding:5px; border:1px black</p> 
Panel
borderColorgrey
bgColorazul
titleColorblack
titleBGColorlemonchiffon
borderStylesolid
titleCombining Color and Size
Html bobswift
<p style="font-weight:normal;">Here is a selection of text styles:</p> 

<p style="color:red; font-size:75%;">small and red</p> 

<p style="color:green; font-weight:bold; font-size:150%;">bold, large and green</p> 

<p style="color:blue; font-family: monospace;">blue monospace</p> 

<p style="display:block; padding:5px; border:1px black</p> 
 

 

 

 

 

 

 

 

 

 

 

 

this is plain text



...

Background Class Colors with CSS

REDCap's css includes some familiar background-colored warning boxes. Here is an example where a descriptive text question is used as a warning when someone tries to collect another time point in a longitudinal study without checking the enrollment status of the participant first. The code presented below is placed in the Field Label column (column E) in your data dictionary, or the Field Label box in the Online Designer.

Image Added

The code looks like:

Code Block
<div class="red" style="text-align:center;">
<h3 style="text-align:center;">Participant is not ACTIVE</h3>
Please review participant status form before continuing.
</div>

Copy and paste single line of the code below directly in the Field Label cell or your Online Designer
<div class="red" style="text-align:center;"><h3 style="text-align:center;">Participant is not ACTIVE</h3>Please review participant status form before continuing.</div>

Image Added

You can also use "yellow" and "green".

Image Added

Image Added

Highlight a sub-section within a larger section with CSS

This can be used to highlight or distinguish sub-sections within a larger section, without using the Section Header column. This is a 'descriptive' field.

Image Added

The code looks like:


Code Block
<div class="red" style="text-align:center;">
<h3 style="text-align:center;">Participant is not ACTIVE</h3>
<table width="100%" bgcolor="CCFFCC"><tr><td>OCT Tumor</td></tr></table>
Please review participant status form before continuing.
</div>

The line of code added is:
<table width="100%" bgcolor="CCFFCC"><tr><td>OCT Tumor</td></tr></table>

You can use standard colors ("red", "yellow", "green", "blue", etc.), or hexadecimal color codes (link to more html colors)

Text in a box and colored, centered, larger text using H3 with CSS

Image Added

The code looks like: (with some extra carriage returns so it doesn't scroll so far to the right)

Code Block
<p style="border:1px solid black;padding:2px;">
<span style="display:block;border:1px solid grey;padding:10px;font-size: 125%;">
I am going to ask you a few questions to determine whether you are eligible to be in the study. 
<span style="font-weight: normal; font-style:italic;">
[Interviewer: Ask all questions without stopping until you reach "Determine Eligibility before continuing!"]
</span></span></p>
<h3 style="text-align: center; color: #800000;">Identifying Information</h3>
1. Name:



Highlighting 


Image Added



The code looks like:

Code Block
<div style="width: 100%; background-color: #fffacd; padding: 5px; position: relative; top: -5px; left: -5px;">Demographics Information<br />
 <div style="width:100%; color:#FFF; background-color:#F00; padding:5px; position:relative; top:-5px; left:-5px;">Confidential</div></div>



Image Added


The code looks like:


Code Block
<div class="green">Full Name</div> 




Additional Tags

There are also additional tags that are currently supported when making REDCap forms and surveys. 

These following tags may be used to define paragraphs, anchors (web links), and line breaks: 

Line Break 

<br>

Paragraphs 

<p>.......</p>

Anchors (web links) 

<a>.......</a>

Indent

&nbsp;


To see additional available HTML tags and formatting ideas, please check out this example survey.