8
Most read
11
Most read
13
Most read
How to create a Radio
button for a form in HTML
5 with CSS styling
By Elke Dunn
Creating the form….
First thing we need to do is open either notepad or notepad ++.
If you choose notepad ++ you need to set the language to
HTML and save the document as a .html document.

Now we need to define the document type. You do this at the
top of the page by using

<!DOCTYPE html>
The next step . . .
Now you need to set up the basics of your code.
Every piece of code you open you need to close.

<html>
          <head>
                   <title>Put the name of your website here</title>
          </head>
          <body>
          <h1>Your heading here</h1>
          </body>
</html>
Now to create the form
The form is apart of the <body>
Under your heading you have put in your body you need to
declare that it is a form.

<body>
         <h1>your heading here</h1>
<form>
       *form info here*
</form>
</body>
The radio button
We will create a radio button group. With this you need to pick
what your options are going to say.
Below is the question and the options that we are going to
code.
Who is your favourite sports personal?
- Ian Thorpe
- Harry Kewell
- Rodger Feddera
- Lance Armstrong
- Other
Radio button in HTML
We need to create a <fieldset> and also a <legend> that
contains our question for the form.

Then we also need to put the radio button in the form by using
the following code.
<input type="radio" name="sports" value="Harry Kewell"
id="HarryKewell" />
<label for="Harry Kewell">Harry Kewell </label><br />

(continued on next page)
What it should look like in the form
<form>
     <fieldset>
               <legend>Who is your favourite sports personal?</legend>

                <input type="radio" name="sports" value="Harry Kewell" id="HarryKewell" />
                 <label for="Harry Kewell">Harry Kewell </label><br />
                 <input type="radio" name="sports" value="Ian Thorpe“ id=“IanThorpe” />
                 <label for="Ian Thorpe">Ian Thorpe </label><br />
                 <input type="radio" name="sports" value="Rodger Feddera" id=“RodgerFeddera” />
                 <label for="Rodger Feddera">Rodger Feddera </label><br />
                 <input type="radio" name="sports" value="Lance Armstrong“ id=“LanceArmstrong” />
                 <label for="Lance Armstrong">Lance Armstrong </label><br />
                 <input type="radio" name="sports" value="Other" id=“Other“ />
                 <label for="Other"> Other </label><br />
      </fieldset>
      </br>
</form>
Controls
You can add some controls into your form. So that if you select
an option you can submit it or reset the form.
The code below goes just before the bottom of the form.



     <p>Form controls</p>
     <input type="reset" value="Reset"/>
     <input type="submit" value="Submit"/> <br>
</form>
Footer
Now before we finish up the html code and move on to the CCS
styling there is one more thing. You can have a footer.

This goes just after the close of the form and before the closing of
the body as shown below.

<div id="footer">
          <p> Made by Elke Dunn Incorporated
          </p>
        </div>
        </body>
</html>
Now your code should look
like……
<!DOCTYPE html>
<html>

      <head>
             <title> QUIZZZZZZZ! </title>
      </head>
      <body>
             <h1> Sports Quiz </h1>
      <form>
             <fieldset>
                       <legend>Who is your favourite sports personal?</legend>

                                 <input type="radio" name="sports" value="Harry Kewell" id="HarryKewell" />
                                 <label for="Harry Kewell">Harry Kewell </label><br />
                                 <input type="radio" name="sports" value="Ian Thorpe" id="IanThorpe" />
                                 <label for="Ian Thorpe">Ian Thorpe </label><br />
                                 <input type="radio" name="sports" value="Rodger Feddera" id="RodgerFeddera"/>
                                 <label for="Rodger Feddera">Rodger Feddera </label><br />
                                 <input type="radio" name="sports" value="Lance Armstrong" id="LanceArmstrong"/>
                                 <label for="Lance Armstrong">Lance Armstrong </label><br />
                                 <input type="radio" name="sports" value="Other" id="Other"/>
                                 <label for="Other"> Other </label><br />
                </fieldset>
                <br />

                <p>Form controls</p>
                <input type="reset" value="Reset"/>
                <input type="submit" value="Submit"/> <br>
      </form>

      <div id="footer">
      <p> Made by Elke Dunn Incorporated
      </p>
      </div>

      </body>

</html>
CSS
Now you need to create another notepad document and save it
as a .css document

In our html document you know need to link the two notepad
documents together. By adding in the following code under our
<title> QUIZZZZZ</title>

<link rel="stylesheet" type="text/css" href="css.css"
media="all"/>
                                                  continued….
Style
In our CSS document we are going to make our back ground
of the form Black and the text White.

We are also going to make our heading a separate colour.

Our footer is going to be a White back ground with Black text.

The following code will help you style this. Colour is spelt color
because of its background.
CSS elements

body
{
       background:#000000;
       color:#FFFFFF;
       width: 300px;
}

h1
{
       color:#9999FF;
}
CSS elements continued….
legend
{
           color:#FFFFFF;
}

fieldset
{
           color:#FFFFFF;
}
Elements continued…
#footer
{
          background-color:#FFFFFF;
          color:#000000;

}
Viewing in a web page
To view your website you need to go to the file location and
double click the html file.

Once you have done this try and open it in a verity of different
web browsers.

Hopefully this starts to help you develop your website.
The End . . .

More Related Content

PPTX
How to code radio buttons in HTML5 and CSS Styling
PPT
Introduction html
PPTX
HTML all tags .........its to much helpful for beginners
PDF
An Intro to HTML & CSS
PDF
Basic tags
PDF
Html bangla
PDF
Bangla html
PDF
Html tags describe in bangla
How to code radio buttons in HTML5 and CSS Styling
Introduction html
HTML all tags .........its to much helpful for beginners
An Intro to HTML & CSS
Basic tags
Html bangla
Bangla html
Html tags describe in bangla

What's hot (19)

PDF
Getting Information through HTML Forms
PPTX
Html5 structure tags
PDF
1.1 html lec 1
PPTX
Css colors
PPTX
FYBSC IT Web Programming Unit II Html 5 Tables, Forms and Media
PDF
Intro to HTML
PPTX
Html Basic Tags
KEY
HTML presentation for beginners
PPTX
Css pseudo classes
PPTX
FYBSC IT Web Programming Unit I HTML 5 & andcss
PPT
Learn CSS From Scratch
PPTX
HTML [Basic] --by Abdulla-al Baset
PPT
webDen Hi-Fi
PDF
Html tags or elements
PPTX
PPT
HTML (Hyper Text Markup Language) by Mukesh
PPTX
Web designing (2) - CSS Basic Coding
Getting Information through HTML Forms
Html5 structure tags
1.1 html lec 1
Css colors
FYBSC IT Web Programming Unit II Html 5 Tables, Forms and Media
Intro to HTML
Html Basic Tags
HTML presentation for beginners
Css pseudo classes
FYBSC IT Web Programming Unit I HTML 5 & andcss
Learn CSS From Scratch
HTML [Basic] --by Abdulla-al Baset
webDen Hi-Fi
Html tags or elements
HTML (Hyper Text Markup Language) by Mukesh
Web designing (2) - CSS Basic Coding
Ad

Viewers also liked (18)

PDF
CITY OF SAN JOSE- ENFORCING WAGE STANDARDS THROUGH LABOR COMPLAINTS AND CONTR...
DOC
Ghazawi-CV updat - April 2016
PDF
Boletim Informativo - SE/PRST - 66ª RO
PDF
Konfor Alanı - Comfort Zone
DOCX
Pérez yeximar tema1b.doc
DOCX
Ing romano isack ortiz
PPTX
新世代的媒體製作 新聞廣告廣播電視與電影
PDF
Permendikbud tahun2014 nomor104
PDF
методичка по олимпиаде
PPTX
niconicogakkai_8th_TetsuyaSato
DOC
alvine_somaroo_cv
PDF
From Food Idea to Local Food Shelf Presentation of Aug 2014
PDF
MTC Recruitment Volunteers Presentation - March 2014
PPTX
PPTX
disseration presentation
PDF
Fremtidens-Projektleder-JacobN
PDF
Raspberry pi-spectrum-analyzer-display-on-rgb-led-strip
PPT
Tech n’More PPT
CITY OF SAN JOSE- ENFORCING WAGE STANDARDS THROUGH LABOR COMPLAINTS AND CONTR...
Ghazawi-CV updat - April 2016
Boletim Informativo - SE/PRST - 66ª RO
Konfor Alanı - Comfort Zone
Pérez yeximar tema1b.doc
Ing romano isack ortiz
新世代的媒體製作 新聞廣告廣播電視與電影
Permendikbud tahun2014 nomor104
методичка по олимпиаде
niconicogakkai_8th_TetsuyaSato
alvine_somaroo_cv
From Food Idea to Local Food Shelf Presentation of Aug 2014
MTC Recruitment Volunteers Presentation - March 2014
disseration presentation
Fremtidens-Projektleder-JacobN
Raspberry pi-spectrum-analyzer-display-on-rgb-led-strip
Tech n’More PPT
Ad

Similar to Creating a radiobutton (20)

PPSX
HTML5 - Forms
PPTX
Building and styling forms
PPTX
Forms Part 1
PPTX
unit2_HTML_Forms fundamentals of html and crore concepts.pptx
PPTX
uptu web technology unit 2 html
PPTX
Entering User Data from a Web Page HTML Forms
PPTX
web-lab2 for computer science html tss css java
PPTX
Episode 14 - Basics of HTML for Salesforce
PPTX
HTML FORMS.pptx
PPTX
Basic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJS
PPTX
Designing web pages html forms and input
PPSX
DIWE - Coding HTML for Basic Web Designing
PDF
Lecture17.pdf
PPTX
Html Forms for lecture BSIT SSC HCI LECTURE
PPT
Html class-04
PPT
Html Forms for creating frames and frameset
PPTX
Building html forms
PDF
CSS_Forms.pdf
HTML5 - Forms
Building and styling forms
Forms Part 1
unit2_HTML_Forms fundamentals of html and crore concepts.pptx
uptu web technology unit 2 html
Entering User Data from a Web Page HTML Forms
web-lab2 for computer science html tss css java
Episode 14 - Basics of HTML for Salesforce
HTML FORMS.pptx
Basic of HTML, CSS(StyleSheet), JavaScript(js), Bootstrap, JSON & AngularJS
Designing web pages html forms and input
DIWE - Coding HTML for Basic Web Designing
Lecture17.pdf
Html Forms for lecture BSIT SSC HCI LECTURE
Html class-04
Html Forms for creating frames and frameset
Building html forms
CSS_Forms.pdf

Recently uploaded (20)

PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PDF
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Developing a website for English-speaking practice to English as a foreign la...
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PPTX
Modernising the Digital Integration Hub
PPT
What is a Computer? Input Devices /output devices
PDF
Five Habits of High-Impact Board Members
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Flame analysis and combustion estimation using large language and vision assi...
PDF
OpenACC and Open Hackathons Monthly Highlights July 2025
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
Abstractive summarization using multilingual text-to-text transfer transforme...
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
The influence of sentiment analysis in enhancing early warning system model f...
PDF
STKI Israel Market Study 2025 version august
PDF
A proposed approach for plagiarism detection in Myanmar Unicode text
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
Credit Without Borders: AI and Financial Inclusion in Bangladesh
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
CloudStack 4.21: First Look Webinar slides
Developing a website for English-speaking practice to English as a foreign la...
Final SEM Unit 1 for mit wpu at pune .pptx
Modernising the Digital Integration Hub
What is a Computer? Input Devices /output devices
Five Habits of High-Impact Board Members
Chapter 5: Probability Theory and Statistics
Flame analysis and combustion estimation using large language and vision assi...
OpenACC and Open Hackathons Monthly Highlights July 2025
Getting started with AI Agents and Multi-Agent Systems
Abstractive summarization using multilingual text-to-text transfer transforme...
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
A contest of sentiment analysis: k-nearest neighbor versus neural network
NewMind AI Weekly Chronicles – August ’25 Week III
The influence of sentiment analysis in enhancing early warning system model f...
STKI Israel Market Study 2025 version august
A proposed approach for plagiarism detection in Myanmar Unicode text
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...

Creating a radiobutton

  • 1. How to create a Radio button for a form in HTML 5 with CSS styling By Elke Dunn
  • 2. Creating the form…. First thing we need to do is open either notepad or notepad ++. If you choose notepad ++ you need to set the language to HTML and save the document as a .html document. Now we need to define the document type. You do this at the top of the page by using <!DOCTYPE html>
  • 3. The next step . . . Now you need to set up the basics of your code. Every piece of code you open you need to close. <html> <head> <title>Put the name of your website here</title> </head> <body> <h1>Your heading here</h1> </body> </html>
  • 4. Now to create the form The form is apart of the <body> Under your heading you have put in your body you need to declare that it is a form. <body> <h1>your heading here</h1> <form> *form info here* </form> </body>
  • 5. The radio button We will create a radio button group. With this you need to pick what your options are going to say. Below is the question and the options that we are going to code. Who is your favourite sports personal? - Ian Thorpe - Harry Kewell - Rodger Feddera - Lance Armstrong - Other
  • 6. Radio button in HTML We need to create a <fieldset> and also a <legend> that contains our question for the form. Then we also need to put the radio button in the form by using the following code. <input type="radio" name="sports" value="Harry Kewell" id="HarryKewell" /> <label for="Harry Kewell">Harry Kewell </label><br /> (continued on next page)
  • 7. What it should look like in the form <form> <fieldset> <legend>Who is your favourite sports personal?</legend> <input type="radio" name="sports" value="Harry Kewell" id="HarryKewell" /> <label for="Harry Kewell">Harry Kewell </label><br /> <input type="radio" name="sports" value="Ian Thorpe“ id=“IanThorpe” /> <label for="Ian Thorpe">Ian Thorpe </label><br /> <input type="radio" name="sports" value="Rodger Feddera" id=“RodgerFeddera” /> <label for="Rodger Feddera">Rodger Feddera </label><br /> <input type="radio" name="sports" value="Lance Armstrong“ id=“LanceArmstrong” /> <label for="Lance Armstrong">Lance Armstrong </label><br /> <input type="radio" name="sports" value="Other" id=“Other“ /> <label for="Other"> Other </label><br /> </fieldset> </br> </form>
  • 8. Controls You can add some controls into your form. So that if you select an option you can submit it or reset the form. The code below goes just before the bottom of the form. <p>Form controls</p> <input type="reset" value="Reset"/> <input type="submit" value="Submit"/> <br> </form>
  • 9. Footer Now before we finish up the html code and move on to the CCS styling there is one more thing. You can have a footer. This goes just after the close of the form and before the closing of the body as shown below. <div id="footer"> <p> Made by Elke Dunn Incorporated </p> </div> </body> </html>
  • 10. Now your code should look like……
  • 11. <!DOCTYPE html> <html> <head> <title> QUIZZZZZZZ! </title> </head> <body> <h1> Sports Quiz </h1> <form> <fieldset> <legend>Who is your favourite sports personal?</legend> <input type="radio" name="sports" value="Harry Kewell" id="HarryKewell" /> <label for="Harry Kewell">Harry Kewell </label><br /> <input type="radio" name="sports" value="Ian Thorpe" id="IanThorpe" /> <label for="Ian Thorpe">Ian Thorpe </label><br /> <input type="radio" name="sports" value="Rodger Feddera" id="RodgerFeddera"/> <label for="Rodger Feddera">Rodger Feddera </label><br /> <input type="radio" name="sports" value="Lance Armstrong" id="LanceArmstrong"/> <label for="Lance Armstrong">Lance Armstrong </label><br /> <input type="radio" name="sports" value="Other" id="Other"/> <label for="Other"> Other </label><br /> </fieldset> <br /> <p>Form controls</p> <input type="reset" value="Reset"/> <input type="submit" value="Submit"/> <br> </form> <div id="footer"> <p> Made by Elke Dunn Incorporated </p> </div> </body> </html>
  • 12. CSS Now you need to create another notepad document and save it as a .css document In our html document you know need to link the two notepad documents together. By adding in the following code under our <title> QUIZZZZZ</title> <link rel="stylesheet" type="text/css" href="css.css" media="all"/> continued….
  • 13. Style In our CSS document we are going to make our back ground of the form Black and the text White. We are also going to make our heading a separate colour. Our footer is going to be a White back ground with Black text. The following code will help you style this. Colour is spelt color because of its background.
  • 14. CSS elements body { background:#000000; color:#FFFFFF; width: 300px; } h1 { color:#9999FF; }
  • 15. CSS elements continued…. legend { color:#FFFFFF; } fieldset { color:#FFFFFF; }
  • 16. Elements continued… #footer { background-color:#FFFFFF; color:#000000; }
  • 17. Viewing in a web page To view your website you need to go to the file location and double click the html file. Once you have done this try and open it in a verity of different web browsers. Hopefully this starts to help you develop your website.
  • 18. The End . . .