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

              
                <!-- Folder image is from badassoftheweek.com which was part of the inspiration for this pen. I don't own the soldier portraits, their sorces can be found in the js section. -->
<div class="wrapper">
  <div class="folder">
    <div class="info">
      <h1>WWII Soldier Generator</h1>
      <p>In honor of those who served in WWII, click the button to create a soldier. While these are fake, make sure to thank a real veteran for their service to our country!</p>
      <input onclick="generateName()" type="submit" value="Generate Soldier!" />
    </div>
    <div class="clearfix"></div>
    <div id="img"></div>
  </div>
</div>
              
            
!

CSS

              
                html {
  font-family:courier new;
  color:#333;
  font-weight:bold;
  text-align:center;
  background: url(http://www.arcides.com/images/background.gif) repeat;
  background-color:#708090;
  background-size: contain;
}
.clearfix {
  overflow: auto;
  zoom: 1;
}
.info {margin-left:10px;}
#img img{width:150px; margin-left:20px; margin-right:50px;}
.wrapper {
  width: 768px;
  height: 564px;
  position: absolute;
  padding:0 10px;
  top: 50%;
  left: 50%;
  margin: -282px 0 0 -384px;
  background: url(http://www.badassoftheweek.com/foldersB.png) no-repeat;
  background-size:contain;
 filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#66000000,endColorstr=#66000000);  
    zoom: 1;
}

.folder {margin:80px 50px 10px 20px;}
#dogtag {width:350px; height:150px;margin-left:180px; background: url(http://nicksantini.com/img/dogtag.png) no-repeat;
background-size:contain;}
h1 {
  font-size: 1.5em;
  line-height: 1em;
}
h2 {
  font-size: 1.25em;
  line-height: .2em;
}
p { text-align:left; }

input[type="submit"] {
  background: url(https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQd7IVuWN4PzwmSL3hxb6UQOUgtFdMpUKpmUWc3aZ0D2KFgLGkJ);
  border: none;
  border-radius: .5em;
  color: #5b4732;
  cursor: pointer;
  display: inline-block;
  font-family: sans-serif;
  font-size: 1em;
  font-weight: bold;
  line-height: 1.5;
  margin: 0 .5em 1em;
  padding: .5em 1.5em .75em;
  position: relative;
  text-decoration: none;
  text-align:center;
  text-shadow: 0 1px 1px hsla(0,0%,100%,.25);
  vertical-align: middle;
}
input[type="submit"]:hover {
  outline: none;
}
input[type="submit"]:hover,
input[type="submit"]:focus {
  box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.2),
              inset 0 2px 0 hsla(0,0%,100%,.1),
              inset 0 1.2em 0 hsla(0,0%,100%,.1),
              inset 0 -.2em 0 hsla(0,0%,100%,.1),
              inset 0 -.25em 0 hsla(0,0%,0%,.25),
              inset 0 0 0 3em hsla(0,0%,100%,.2),
              0 .25em .25em hsla(0,0%,0%,.05);
}
input[type="submit"]:active {
  box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.2),
              inset 0 2px 0 hsla(0,0%,100%,.1),
              inset 0 1.2em 0 hsla(0,0%,100%,.1),
              inset 0 0 0 3em hsla(0,0%,100%,.2),
              inset 0 .25em .5em hsla(0,0%,0%,.05),
              0 -1px 1px hsla(0,0%,0%,.1),
              0 1px 1px hsla(0,0%,100%,.25);
  margin-top: .25em;
  outline: none;
  padding-bottom: .5em;
  color:#ddd;
}
*:focus { outline: 0; }
*{box-sizing:border-box;}
              
            
!

JS

              
                function generateName(){
  var rank = ['PRIVATE', 'SPECIALIST', 'PRIVATE FIRST CLASS', 'CORPORAL', 'SERGEANT', 'STAFF SERGEANT', 'TECHNICAL SERGEANT', 'FIRST SERGEANT', 'MASTER SERGEANT', 'SECOND LIEUTENANT', 'FIRST LIEUTENANT', 'CAPTAIN', 'MAJOR', 'LIEUTENANT COLONEL', 'COLONEL', 'BRIGADIER GENERAL', 'MAJOR GENERAL', 'LIEUTENANT GENERAL', 'GENERAL'];

	var first = ['ROBERT', 'JOHN', 'JAMES', 'WILLIAM', 'CHARLES', 'GEORGE', 'JOSEPH', 'RICHARD', 'EDWARD', 'DONALD', 'THOMAS', 'FRANK', 'HAROLD', 'PAUL', 'RAYMOND', 'WALTER', 'JACK', 'HENRY', 'KENNETH', 'ARTHUR', 'ALBERT', 'DAVID', 'HARRY', 'EUGENE', 'RALPH', 'HOWARD', 'CARL', 'WILLIE', 'LOUIS', 'CLARENCE', 'EARL', 'ROY', 'FRED', 'JOE', 'FRANCIS', 'LAWRENCE', 'HERBERT', 'LEONARD', 'ERNEST', 'ALFRED', 'ANTHONY', 'STANLEY', 'NORMAN', 'GERALD', 'DANIEL', 'SAMUEL', 'BERNARD', 'BILLY', 'MELVIN', 'MARVIN', 'WARREN', 'MICHAEL', 'LEROY', 'RUSSELL', 'LEO', 'ANDREW', 'EDWIN', 'ELMER', 'PETER', 'FLOYD', 'LLOYD', 'RAY', 'FREDERICK', 'THEODORE', 'CLIFFORD', 'VERNON', 'HERMAN', 'CLYDE', 'CHESTER', 'PHILIP', 'ALVIN', 'LESTER', 'WAYNE', 'VINCENT', 'GORDON', 'LEON', 'LEWIS', 'CHARLIE', 'GLENN', 'CALVIN', 'MARTIN', 'MILTON', 'LEE', 'JESSE', 'DALE', 'CECIL', 'BILL', 'HARVEY', 'ROGER', 'VICTOR', 'BENJAMIN', 'WALLACE', 'RONALD', 'SAM', 'ALLEN', 'ARNOLD', 'WILLARD', 'GILBERT', 'EDGAR', 'OSCAR', 'GENE', 'JERRY', 'DOUGLAS', 'JOHNNIE', 'CLAUDE', 'DON', 'EDDIE', 'ROLAND', 'EVERETT', 'MAURICE', 'CURTIS', 'MARION', 'VIRGIL', 'WILBUR', 'MANUEL', 'STEPHEN', 'JEROME', 'HOMER', 'LESLIE', 'GLEN', 'JESSIE', 'HUBERT', 'JOSE', 'JIMMIE', 'SIDNEY', 'MORRIS', 'HUGH', 'MAX', 'BOBBY', 'BOB', 'NICHOLAS', 'LUTHER', 'BRUCE', 'JUNIOR', 'WESLEY', 'RUDOLPH', 'ALEXANDER', 'FRANKLIN', 'TOM', 'IRVING', 'HORACE', 'WILLIS', 'PATRICK', 'STEVE', 'JOHNNY', 'DEAN', 'JULIUS', 'KEITH', 'OLIVER', 'EARNEST', 'BEN', 'JIM', 'TONY', 'EDMUND', 'LYLE', 'GUY', 'SALVATORE', 'ORVILLE', 'DELBERT', 'BILLIE', 'PHILLIP', 'CLAYTON', 'OTIS', 'ARCHIE', 'ALEX', 'ANGELO', 'MIKE', 'JACOB', 'CLIFTON', 'BENNIE', 'MATTHEW', 'DUANE', 'CLINTON', 'DENNIS', 'WILBERT', 'DAN', 'JAY', 'MARSHALL', 'LELAND', 'MERLE', 'IRA', 'NATHANIEL', 'IVAN', 'ERVIN', 'JIMMY', 'IRVIN', 'ALTON', 'LOWELL', 'DEWEY', 'LARRY', 'EMIL', 'ANTONIO', 'WILFRED', 'ELBERT', 'JUAN', 'ALAN', 'ALLAN', 'LONNIE', 'NELSON', 'FORREST'];
  
	var kin = ['BETTY', 'BARBARA', 'SHIRLEY', 'PATRICIA', 'DOROTHY', 'JOAN', 'MARGARET', 'NANCY', 'HELEN', 'CAROL', 'JOYCE', 'DORIS', 'RUTH', 'VIRGINIA', 'MARILYN', 'ELIZABETH', 'JEAN', 'FRANCES', 'BEVERLY', 'LOIS', 'ALICE', 'DONNA', 'MARTHA', 'DOLORES', 'JANET', 'PHYLLIS', 'NORMA', 'CAROLYN', 'EVELYN', 'GLORIA', 'ANNA', 'MARIE', 'ANN', 'MILDRED', 'ROSE', 'PEGGY', 'GERALDINE', 'CATHERINE', 'JUDITH', 'LOUISE', 'JANICE', 'MARJORIE', 'ANNIE', 'RUBY', 'ELEANOR', 'JANE', 'SANDRA', 'IRENE', 'WANDA', 'ELAINE', 'JUNE', 'JOANNE', 'RITA', 'FLORENCE', 'DELORES', 'LILLIAN', 'MARLENE', 'EDNA', 'SARAH', 'PATSY', 'LORRAINE', 'THELMA', 'JOSEPHINE', 'JUANITA', 'BONNIE', 'ARLENE', 'GLADYS', 'JOANN', 'SALLY', 'CHARLOTTE', 'KATHLEEN', 'AUDREY', 'PAULINE', 'WILMA']
  
	var last = ['SMITH', 'JOHNSON', 'WILLIAMS', 'BROWN', 'JONES', 'MILLER', 'DAVIS', 'GARCIA', 'RODRIGUEZ', 'WILSON', 'MARTINEZ', 'ANDERSON', 'TAYLOR', 'THOMAS', 'HERNANDEZ', 'MOORE', 'MARTIN', 'JACKSON', 'THOMPSON', 'WHITE', 'LOPEZ', 'LEE', 'GONZALEZ', 'HARRIS', 'CLARK', 'LEWIS', 'ROBINSON', 'WALKER', 'PEREZ', 'HALL', 'YOUNG', 'ALLEN', 'SANCHEZ', 'WRIGHT', 'KING', 'SCOTT', 'GREEN', 'BAKER', 'ADAMS', 'NELSON', 'HILL', 'RAMIREZ', 'CAMPBELL', 'MITCHELL', 'ROBERTS', 'CARTER', 'PHILLIPS', 'EVANS', 'TURNER', 'TORRES', 'PARKER', 'COLLINS', 'EDWARDS', 'STEWART', 'FLORES', 'MORRIS', 'MURPHY', 'RIVERA', 'COOK', 'ROGERS', 'MORGAN', 'PETERSON', 'COOPER', 'REED', 'BAILEY', 'BELL', 'GOMEZ', 'KELLY', 'HOWARD', 'WARD', 'COX', 'DIAZ', 'RICHARDSON', 'WOOD', 'WATSON', 'BROOKS', 'BENNETT', 'GRAY', 'JAMES', 'REYES', 'CRUZ', 'HUGHES', 'PRICE', 'MYERS', 'LONG', 'FOSTER', 'SANDERS', 'ROSS', 'MORALES', 'POWELL', 'SULLIVAN', 'RUSSELL', 'ORTIZ', 'JENKINS', 'GUTIERREZ', 'PERRY', 'BUTLER', 'BARNES', 'FISHER', 'HENDERSON', 'COLEMAN', 'SIMMONS', 'PATTERSON', 'JORDAN', 'REYNOLDS', 'HAMILTON', 'GRAHAM', 'KIM', 'GONZALES', 'ALEXANDER', 'RAMOS', 'WALLACE', 'GRIFFIN', 'WEST', 'COLE', 'HAYES', 'CHAVEZ', 'GIBSON', 'BRYANT', 'ELLIS', 'STEVENS', 'MURRAY', 'FORD', 'MARSHALL', 'OWENS', 'MCDONALD', 'HARRISON', 'KENNEDY', 'WELLS', 'ALVAREZ', 'WOODS', 'MENDOZA', 'CASTILLO', 'OLSON', 'WEBB', 'WASHINGTON', 'TUCKER', 'FREEMAN', 'BURNS', 'HENRY', 'SNYDER', 'SIMPSON', 'CRAWFORD', 'PORTER', 'MASON', 'SHAW', 'GORDON', 'WAGNER', 'HUNTER', 'ROMERO', 'HICKS', 'DIXON', 'HUNT', 'PALMER', 'ROBERTSON', 'BLACK', 'HOLMES', 'STONE', 'MEYER', 'BOYD', 'MILLS', 'WARREN', 'FOX', 'ROSE', 'RICE', 'MORENO', 'SCHMIDT', 'FERGUSON', 'NICHOLS', 'HERRERA', 'MEDINA', 'RYAN', 'FERNANDEZ', 'WEAVER', 'DANIELS', 'STEPHENS', 'GARDNER', 'PAYNE', 'KELLEY', 'DUNN', 'PIERCE', 'ARNOLD', 'SPENCER', 'PETERS', 'HAWKINS', 'GRANT', 'HANSEN', 'HOFFMAN', 'HART', 'ELLIOTT', 'CUNNINGHAM', 'KNIGHT', 'BRADLEY', 'CARROLL', 'HUDSON'];
  
	var serial = "";
	var stnumber = "";
	var possible = "0123456789";
 
	var street = ['BOUTWELL', 'RANCHO', 'WARELAND BLVD', 'LANGLEY', 'FICHTER', 'HIGUERO', 'DEEP COVE', 'OLEN', 'UTTER', 'SUMMER', 'MISTY FALLS', 'ROSE', 'BOYCE', 'CLAYMORE', 'CRESTBURY', 'COLORADO', 'BROADGATE', 'BROOMHALL', 'HEWIN', 'LOVAS', 'BANQUO'];
  
	var streetEnd = ['RD', 'CT', 'PKWY', 'ST', 'DR']
 
	var city = ['Chester, NY', 'Cedar Hill, MO', 'Boulder, CO', 'North Loup, NE', 'Poplar, WI', 'Quaker City, OH', 'Tuscola, TX', 'Duluth, MN', 'West Elizabeth, PA', 'Troy, MI', 'Temple Hills, MD', 'Richmond, IN', 'Bowie, MD', 'Louisville, KY', 'Fall River, MA', 'Knoxville, TN', 'Hope Valley, RI', 'Hampton Bays, NY', 'Jarratt, VA', 'Crawfordville, GA']
  
	var img = ['www.writeonnewjersey.com/wp-content/uploads/2010/05/Uncle-Joey-Ermilio.jpg','mediad.publicbroadcasting.net/p/ksmumain/files/styles/x_large/public/201406/Uncle_John_in_uniform_0.jpg', 'cdn.ipernity.com/111/63/57/4586357.7a9b5c8c.640.jpg?r2',  '4.bp.blogspot.com/_1E9VCRyh2Wg/THXQKkkwQPI/AAAAAAAAAqg/rOZNuAKiRYk/s1600/ArthurArmyPortrait.bmp', 'www.colley.com/pictures-selected-from-dads-album/Dads-Pictures/Luster%20Earl%20Colley%20~1945%20(3).png', 'images.dpchallenge.com/images_portfolio/60000-64999/61961/1200/Copyrighted_Image_Reuse_Prohibited_738317.jpg'];
  
  var soldierImg = img[Math.floor(Math.random() * img.length)];
  var soldierRank = rank[Math.floor(Math.random() * rank.length)];
  var firstName = first[Math.floor(Math.random() * first.length)];
  var lastName = last[Math.floor(Math.random() * last.length)];
  var soldierKin = kin[Math.floor(Math.random() * kin.length)];
  var soldierStreet = street[Math.floor(Math.random() * street.length)];
	var soldierStreetEnd = streetEnd[Math.floor(Math.random() * streetEnd.length)];
  
  for( var i=0; i < 8; i++ )
     serial += possible.charAt(Math.floor(Math.random() * possible.length));
  for( var i=0; i < 4; i++ )
     stnumber += possible.charAt(Math.floor(Math.random() * possible.length));
  
	var soldierCity = city[Math.floor(Math.random() * city.length)];
  

	var pic = document.getElementById('img');
  
	pic.innerHTML = "<img src='http://" + soldierImg + "' style='background:#fff; padding:10px;' align='left'>" + "<div id='dogtag'>" + "<p>" + "<br>" + soldierRank + "<br>" + firstName + " " + lastName + "<br>" + serial + " " + "T42 43" + "<br>" + soldierKin + " " + lastName +  "<br>" + stnumber + " " + soldierStreet + " " + soldierStreetEnd + "<br>" + soldierCity + "</p>" + "</div>"

};
              
            
!
999px

Console