Arrange radio buttons vertically in a table

I am attempting to display a vertical list of radio buttons within a table cell. Is this achievable? Here is the code snippet I am currently working with:

            <table>
            <tr>
                <td> First Name </td>
                <td> <input type="text" class="profile_input"> </td>
                <td> Student ID </td>
                <td> <input type="text" class="profile_input"> </td>
            </tr>
            <tr>
                <td> Last Name </td>
                <td> <input type="text" class="profile_input"> </td>
                <td> Class </td>
                <td> <select class="select_input">
                      <option value="volvo">V1L</option>
                      <option value="saab">V1C</option>
                      <option value="mercedes">V1E</option>
                      <option value="audi">V1F</option>
                    </select> 
                </td>
            </tr>
            <tr>
                <td> Address </td>
                <td > <input type="text" class="profile_input size2"> </td>
                <td> Field of Study </td>
                <td > SNE <input type="radio" class="profile_input" name="FieldofStudy"> </td>
                <td > BIM <input type="radio" class="profile_input" name="FieldofStudy"> </td>
                <td > SIE <input type="radio" class="profile_input" name="FieldofStudy"> </td>
                <td > SNE <input type="radio" class="profile_input" name="FieldofStudy"> </td>
            </tr>
            <tr>
                <td> Email </td>
                <td> <input type="text" class="profile_input"> </td>
            </tr>
            <tr>
                <td> Phone Number </td>
                <td> <input type="text" class="profile_input"> </td>
            </tr>
            <tr>
                <td> Gender </td>
                <td> Male<input type="radio"  name="gender" class="profile_input"> 
                Female<input type="radio"  name="gender" class="profile_input"> </td>
            </tr>
            <tr>
                <td> Date of Birth </td>
                <td> <input type="date" class="profile_input"> </td>
            </tr>
        </table> 

Alongside the CSS styling for the table:

table {
width:100%;
margin-top:25px;
margin-bottom:25px;
}

input[type="text"], input[type="date"], .select_input {
    min-height:30px;
    border:1px solid black;
    padding:5px;    
    width:75%;
}
table tr {
    padding-bottom:5px;
}

.size2 {
    min-height:60px!important;
}

Currently, the table consists of a left side and a right side. The left side is basic, while the right side needs to include a list of four radio buttons displayed vertically.

Answer №1

To organize them neatly, you can group them in a fieldset and wrap them with labels. Then, in your CSS code, set the label display property to block.

HTML

      <td name="Studierichting">
        <fieldset>
          <label><input type="radio" class="profiel_inp" name="Studierichting">SNE</label>
          <label><input type="radio" class="profiel_inp" name="Studierichting">BIM</label>
          <label><input type="radio" class="profiel_inp" name="Studierichting">SIE</label>
          <label><input type="radio" class="profiel_inp" name="Studierichting">SNE</label>
        </fieldset>

CSS

label {
  display:block;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

My Jquery "animate" is only triggered once instead of on each function call. What could be causing this issue?

I have set my navigation to dock at a specific document height on the top of the viewport, and when it docks, it should display a dropdown animation. $(document).scroll(function(){ var x = $(window).scrollTop(); if(x>=700){ $("header ...

The Art of Repeating: Navigating through a Multi-Layered Array

My PHP Array looks like this: $fruits = array( array("Apple", 1.25), array("Banana", 0.86), ); Desired HTML Output: I want the HTML output to be formatted as follows: Fruit: Apple Price: 1.25 Fruit: Banana Price: 0.86 Attempts Made: I tried ...

A single Modal, Ajax, and data that is continuously refreshed

I'm currently facing a challenge in my project as I try to implement Ajax functionality. Although I'm relatively new to using it, I believe I have a basic understanding of its workings. My website involves collecting form data, posting it to a d ...

Using JavaScript's document.write method to display HTML code, along with a variable retrieved from a Flash application

Can I ask two questions at once? Firstly, how can I achieve the following? document.write(' <div id="jwplayer"> <center> <div id='mediaplayer'></div> <script type="text/javascript"> jwplayer('mediapl ...

Generating symbols that combine both images and text seamlessly

I am working with a circle image that I need to resize based on its placement. This image is intended to be a background for a character or two of text. Specifically, whenever the number 1 or 2 appears in a certain element, I want the circle to appear beh ...

The box on my form is leaking my background color outside the 1px border, but only in Internet Explorer

While experimenting with background gradients and borders one day just for the fun of it, I made an interesting observation in Internet Explorer. The issue I encountered was that the background color was overflowing outside the radius border, but this onl ...

Navigating a series of HTTP requests with VBA and saving the retrieved data in Excel 2010

I have a total of 5 Excel files that I currently use with WinHttpRequest to extract data into them. My goal is to consolidate all the requests into a single VBA script, loop through them, and store the data sequentially on one sheet. However, I am facing ...

Unable to achieve full width for a div within a scrollable container

Currently, I am in the process of constructing a new website using Gatsby.js. However, I have encountered a minor issue with some CSS related to code blocks. Since CSS is not my strong suit, I have been unable to resolve it thus far. Below is a runnable sn ...

Cross-Browser Compatibility of CSS

I have noticed that lists styled with the following CSS code appear differently in Internet Explorer 8 and Firefox 4. In IE8, the rounded corners are missing, while FF4 does not change color when hovering over it. Which browser should I trust for accurate ...

Tips for altering CSS using the `:hover` pseudo-class

CSS Style for Navbar .navbar li { color: #B7B7B7; font-family: 'Montserrat', sans-serif; font-size: 14px; min-width: 70px; padding: 22px 16px 18px; } .navbar #menumain ul { width: 120%; } .navbar ul ul { display: none; } <div ...

Implementing Google Fonts into Next.js with the combination of Sass, CSS, and Semantic UI React

I have set up my next.config.js file with the following configuration: const withSass = require('@zeit/next-sass'); const withCss = require('@zeit/next-css'); module.exports = withSass(withCss({ webpack (config) { config.module. ...

Incorporating a scrolling text box within an <aside> element set in a flex layout

Just trying to make sure the title is clear, as this happens to be my initial post in this space. Lately, I've been venturing back into the creation of websites and currently looking to incorporate a "concert log" below a set of GIFs on my website&apo ...

Bypass the save as dialogue box and initiate automatic file download without interruption

Working on an Angular 1 web application, I am utilizing the HTML download Attribute. Using the code snippet below: <a href="/images/myw3schoolsimage.jpg" download>, I am enabling users to download presented data as an Excel spreadsheet. My goal i ...

Try utilizing MutationObserver to monitor changes in various nodes

I am faced with a situation where I have elements in my HTML that are dynamically populated with text from an API. My goal is to check if all these elements have a value and then trigger a function accordingly. The current code I have only allows me to obs ...

Tips for creating a fixed element with ScrollTrigger and GSAP

How can I prevent the right div from jumping on top of the left div when using a scroll trigger to make the left div's position fixed? gsap.registerPlugin(ScrollTrigger); const tlfour = gsap.timeline({ scrollTrigger: { trigger: ".ma ...

Rendering High-quality Images in Internet Explorer Browser

Currently, I am working on optimizing my website for high resolution monitors, particularly the new iPad. The site is already formatted to my liking, with images having increased resolutions while still fitting into specific DIVs. For instance, an image wi ...

The art of placing images using CSS

I'm having trouble aligning the images into two rows of three, with the news section on the right side below the navigation bar. I've tried different methods but can't seem to get it right. Both the image and link should be clickable, but I& ...

My index.html not successfully linking to the CSS file

I'm new to this and still learning, so please bear with me. I'm having trouble linking my CSS file to my index.html document in order to create a black banner at the top of the page. I've tried opening it in both Chrome and Explorer but noth ...

Is there a way to have two SVG files displayed on a single HTML page at the same time

Currently, I am facing an issue with my graphs. I have a line graph and a boxplot, but the boxplot is appearing below the line graph when I want it to be next to it. Any suggestions on how I can achieve this layout? Thank you! I attempted to use 2 differe ...

Combining the container and container-fluid classes with Bootstrap for versatile layout design

My goal is to have my website display with a fixed width on xs, sm, and md screens, but be fluid on lg screens. After researching the Bootstrap grid system, I discovered that I can use the .container class for fixed width layouts or the .container-fluid ...