Answers.Body: <p>Craft's Request service has a built-in method for this, <a href="https://craftcms.com/docs/templating/craft.request#isLivePreview" rel="noreferrer"><code>isLivePreview</code></a>.</p>
  
  <p>Here's how to only display content in the live preview view:</p>
  
  <pre><code>{% if craft.request.isLivePreview %}
      &lt;p&gt;Only appears in live preview.&lt;/p&gt;
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-06T17:07:06.713Z
Answers.Text: Spot on. Cheers.
Answers.UserDisplayName: ianp
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-06T16:19:45.607Z
Answers.LastActivityDate: 2017-04-06T16:19:45.607Z
Answers.UserDisplayName: Stephen Lewis
Body: <p>Is there any way of adding a class onto a page body when it is viewed within the 'live preview' pane?</p>
  
  <p>I can then use this to make things either show or not show.</p>
  
  <p>I want to do this to highlight specific things to content editors that I don't feel are worth highlighting to regular users.</p>
  
  <p>I think I can only do this by hanging rules off a special 'preview only' class.</p>
  
Tags: <live-preview>
Title: Apply different classes and styles when in 'live preview' pane
ThreadText: # Apply different classes and styles when in 'live preview' pane
  
  (Asked by: username_0 on 2017-04-06)
  
  Is there any way of adding a class onto a page body when it is viewed within the 'live preview' pane?
  
  I can then use this to make things either show or not show.
  
  I want to do this to highlight specific things to content editors that I don't feel are worth highlighting to regular users.
  
  I think I can only do this by hanging rules off a special 'preview only' class.
  
  **Tags:** live-preview
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-04-06. Score: 5 | Accepted answer
  
  Craft's Request service has a built-in method for this, [`isLivePreview`](https://craftcms.com/docs/templating/craft.request#isLivePreview).
  
  Here's how to only display content in the live preview view:
  
  ```
  {% if craft.request.isLivePreview %}
      <p>Only appears in live preview.</p>
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Spot on. Cheers.  
  
  ---
  
  