Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                .main
  #app
  .row
    .col
      pre.
        function Pre() {
          return (
            &lt;pre&gt;
              Hoshimiya Ichigo
              Kirija Aoi
              Shibuki Ran
            &lt;/pre&gt;
          );
        }
    .col
      pre.
        function Pre() {
          return (
            &lt;pre&gt;{`
        Hoshimiya Ichigo
        Kirija Aoi
        Shibuki Ran
            `}&lt;/pre&gt;
          );
        }
              
            
!

CSS

              
                *
  box-sizing: border-box

body
  margin: 0
  background: #f4f4f4
  
.main 
  margin: 0 auto
  padding: 1em 1em 3em
  background: #fff
  max-width: 62em

.row
  display: flex
  justify-content: space-between
  align-items: flex-start
  margin: 0 -1em
  
.col
  padding: 1em
  width: 50%

pre
  padding: .5em
  background: #f4f4f4
  border: 1px solid #eee
  border-radius: .2em

.center
  text-align: center

h1
  font-size: 1.5rem

h2
  font-size: 1.25rem
              
            
!

JS

              
                function Pre1() {
  return (
    <pre>
      Hoshimiya Ichigo
      Kirija Aoi
      Shibuki Ran
    </pre>
  );
}

function Pre2() {
  return (
    <pre>{`
Hoshimiya Ichigo
Kirija Aoi
Shibuki Ran
    `}</pre>
  );
}


function App() {
  return (
    <>
      <h1 className="center">How to new line inside &lt;pre&gt; with JSX </h1>
      <div className="row">
        <div className="col">
          <h2>Use just a children node.</h2>
          <Pre1 />
        </div>
        <div className="col">
          <h2>Use {'{`...`}'} <small>(JavaScript Template literals)</small></h2>
          <Pre2 />
        </div>
      </div>
    </>
  );
}

ReactDOM.render(<App />, document.getElementById('app'));
              
            
!
999px

Console