{"componentChunkName":"component---src-templates-blog-post-js","path":"/blog/freecodecamp/frontend/html/fcc-challenge-32-create-a-set-of-radio-buttons/","result":{"data":{"site":{"siteMetadata":{"title":"Be Brav3"}},"markdownRemark":{"id":"16da2b5d-21bf-5228-9ed1-53a96f4c5911","excerpt":"In Free Code Camp Challenge 32 we learn to create selectable radio buttons. You can use radio buttons for questions where you want the user to only give you one…","html":"<p>In <a href=\"https://www.freecodecamp.com/challenges/create-a-set-of-radio-buttons\">Free Code Camp Challenge 32</a> we learn to create selectable radio buttons.</p>\n<blockquote>\n<p>You can use radio buttons for questions where you want the user to only give you one answer.</p>\n<p>Radio buttons are a type of input</p>\n<p>Each of your radio buttons should be nested within its own label element.</p>\n<p>All related radio buttons should have the same name attribute.</p>\n<p>Here’s an example of a radio button:</p>\n</blockquote>\n<blockquote>\n<p>[html]</p>\n</blockquote>\n<blockquote>\n<p><label><input type=\"radio\" name=\"indoor-outdoor\"> Indoor</label></p>\n</blockquote>\n<blockquote>\n<p>[/html]</p>\n</blockquote>\n<blockquote>\n<p>Add a pair of radio buttons to your form. One should have the option of indoor and the other should have the option of outdoor.</p>\n</blockquote>\n<p>The original code is below:</p>\n<p>[html]</p>\n<link href=\"https://fonts.googleapis.com/css?family=Lobster\" rel=\"stylesheet\" type=\"text/css\">\n  \n<style>\n    \n.red-text {\n      \ncolor: red;\n    \n}\n<p>h2 {</p>\n<p>font-family: Lobster, Monospace;</p>\n<p>}</p>\n<p>p {</p>\n<p>font-size: 16px;</p>\n<p>font-family: Monospace;</p>\n<p>}</p>\n<p>.thick-green-border {</p>\n<p>border-color: green;</p>\n<p>border-width: 10px;</p>\n<p>border-style: solid;</p>\n<p>border-radius: 50%;</p>\n<p>}</p>\n<p>.smaller-image {</p>\n<p>width: 100px;</p>\n<p>}</p>\n</style>\n<h2 class=\"red-text\">CatPhotoApp</h2>\n<p>Click here for <a href=\"#\">cat photos</a>.</p>\n<p><a href=\"#\"><img class=\"smaller-image thick-green-border\" alt=\"A cute orange cat lying on its back. \" src=\"https://bit.ly/fcc-relaxing-cat\"></a></p>\n<p>Things cats love:</p>\n  \n<ul>\n    \n<li>cat nip</li>\n    \n<li>laser pointers</li>\n    \n<li>lasagna</li>\n  \n</ul>\n  \n<p>Top 3 things cats hate:</p>\n  \n<ol>\n    \n<li>flea treatment</li>\n    \n<li>thunder</li>\n    \n<li>other cats</li>\n  \n</ol>\n  \n<form action=\"/submit-cat-photo\">\n    \n<input type=\"text\" placeholder=\"cat photo URL\" required>\n    \n<button type=\"submit\">Submit</button>\n  \n</form>\n  \n[/html]\n<p>The updated code with radio button is below:</p>\n<p>[html highlight=”48-49″]</p>\n<link href=\"https://fonts.googleapis.com/css?family=Lobster\" rel=\"stylesheet\" type=\"text/css\">\n  \n<style>\n    \n.red-text {\n      \ncolor: red;\n    \n}\n<p>h2 {</p>\n<p>font-family: Lobster, Monospace;</p>\n<p>}</p>\n<p>p {</p>\n<p>font-size: 16px;</p>\n<p>font-family: Monospace;</p>\n<p>}</p>\n<p>.thick-green-border {</p>\n<p>border-color: green;</p>\n<p>border-width: 10px;</p>\n<p>border-style: solid;</p>\n<p>border-radius: 50%;</p>\n<p>}</p>\n<p>.smaller-image {</p>\n<p>width: 100px;</p>\n<p>}</p>\n</style>\n<h2 class=\"red-text\">CatPhotoApp</h2>\n<p>Click here for <a href=\"#\">cat photos</a>.</p>\n<p><a href=\"#\"><img class=\"smaller-image thick-green-border\" alt=\"A cute orange cat lying on its back. \" src=\"https://bit.ly/fcc-relaxing-cat\"></a></p>\n<p>Things cats love:</p>\n  \n<ul>\n    \n<li>cat nip</li>\n    \n<li>laser pointers</li>\n    \n<li>lasagna</li>\n  \n</ul>\n  \n<p>Top 3 things cats hate:</p>\n  \n<ol>\n    \n<li>flea treatment</li>\n    \n<li>thunder</li>\n    \n<li>other cats</li>\n  \n</ol>\n  \n<form action=\"/submit-cat-photo\">\n    \n<input type=\"text\" placeholder=\"cat photo URL\" required>\n  \n<label><input type=\"radio\" name=\"indoor-outdoor\">Indoor</label>\n  \n<label><input type=\"radio\" name=\"indoor-outdoor\">Outdoor</label>\n    \n<button type=\"submit\">Submit</button>\n  \n</form>\n  \n[/html]","frontmatter":{"title":"FCC Challenge 32: Create a Set of Radio Buttons","date":"March 13, 2016","description":null}}},"pageContext":{"slug":"/blog/freecodecamp/frontend/html/fcc-challenge-32-create-a-set-of-radio-buttons/","previous":{"fields":{"slug":"/blog/freecodecamp/frontend/html/fcc-challenge-31-use-html5-to-require-a-field/"},"frontmatter":{"title":"FCC Challenge 31: Use HTML5 to Require a Field"}},"next":{"fields":{"slug":"/blog/freecodecamp/frontend/html/fcc-challenge-33-create-a-set-of-checkboxes/"},"frontmatter":{"title":"FCC Challenge 33: Create a Set of Checkboxes"}}}}}