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

              
                head
  link(href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css')

.container
  h1 Random Question Picker
  h3 Topic: The Family <br /> Level: C1
  
  h2#question
  a(href="#") 
    .btn 
      p New Question
              
            
!

CSS

              
                body 
  background-color: #2D3E50
  font-family: 'Open Sans', sans serif
a 
  text-decoration: none

.container
  position: absolute
  background-color: #AEAEAE
  width: 700px
  height: 520px
  margin-left: calc(50% - 350px)
  border-radius: 20px

h1
  color: #E64C66
  font-size: 45px
  text-align: center
  position: relative
  margin-top: 50px
  text-shadow: -1px 1px 1px #333
  
h2 
  text-align: left
  
h3
  margin-left: 50px
  color: #fff
  text-shadow: -1px 1px 1px #333
  
.btn
  font-size: 16px
  width: 300px
  background-color: #E64C66
  color: white
  text-align: center
  padding: 10px
  margin: 40px auto
  border-radius: 20px
  box-shadow: -4px 4px 8px #333
  &:hover
    background-color: (#E64C66 - 5)
    box-shadow: -2px 2px 4px #333
  &:active
    box-shadow: none
    background-color: (#E64C66 - 15)
#question
  color: #2D3E50
  display: inline-block
  border: 1px solid #333
  text-align: center
  padding: 10px
  min-height: 70px
  width: 600px
  margin-left: 40px
  background-color: #fff
  border-radius: 5px
              
            
!

JS

              
                var main = function() {
  //The array of questions
  var questions = [
      'What are the main family structures?',
      'What are the possible reasons for several generations living together?',
      'What problems might emerge in a multi generational household?',
      'How have family roles changed in the last few decades?',
      'What are the typical roles for modern women?',
      'What is the role of government in supporting families?',
      'How can parents contribute to the personality developement of children?',
      'What are the most common parenting styles?',
      'What are the consequences of permissive parenting?',
      'What difficulties does growing up in a single parent family involve?',
      'What do you think the advantages and disadvantages of being an only child are?',
      'How long should children be supported by their families?',
      'Why is there a tendency for young people to leave home at a later age than before?',
      'What adoption practices are most frequent?',
      'What is the difference between adoption and foster care?',
      'Why do some couples cohabit before getting married?',
      'Why do some couples sign a prenuptial agreement?',
      'At what age do people get married nowadays?',
      'What are typical wedding ceremonies like?',
      'What are the main characteristics of wedding receptions in western culture?',
      'What is the ideal age to start a family?',
      'What is the difference between bigamy and polygamy?',
      'Why can adultery occur in a relationship?',
      'Why is the number of divorces increasing nowadays?',
      'What problems can occur after a divorce?',
      'What problems can occur in long-distance relationships?',
      'How have long distance relationships changed recently?',
      'How has the general acceptance of the single lifestyle changed recently?',
      "Who do you think 'mingles' are?"
      ];
  
  //Function triggered when button is clicked
  $('.btn').click(function() {
    //Generate random number between 0 & the length of the array
    var numRand = Math.floor(Math.random() * questions.length);
//Print to html:
    $('#question').text(questions[numRand]);
    //Remove item from array so that the question will not be repeated:
    questions.splice(numRand, 1);
    return false;
  });                     
}

$(document).ready(main);
              
            
!
999px

Console