Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all! We have been experiencing an issue on site where threads have been missing the latest postings. The platform host Vanilla are working on this issue. A workaround that has been used by some is to navigate back from 1 to 10+ pages to re-sync the thread and this will then show the latest posts. Thanks, Mike.
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Vertically Align Radio Buttons In Form

  • 27-01-2014 7:41pm
    #1
    Registered Users, Registered Users 2 Posts: 2,815 ✭✭✭


    I'm trying to code a form where the labels are right aligned against their inputs and I think I have succeeded. However, I am trying to get the radio inputs to align vertically underneath each other but I am struggling. Basically, every radio should be underneath "Ireland".

    I'm been researching for the past few hours and everything suggested isn't working for me. What is the easiest/best way to achieve this? Thanks
    <html>
    <head>
    
    <style type="text/css">
    
    label{
        width:100px;
        display: block;
        text-align: right;
        float:left;
        margin-right: 5px;  
    }
    
    label, input{
        margin-bottom: 5px;    
    }
    
    </style>
    
    </head>
    <body>
    
    <form>
    
    <label for="fname">Firstname: </label>
    <input type="text" id="fname"/><br/>
    
    <label for="sname">Surname: </label>
    <input type="text" id="sname"/> <br/>
    
    <label for="country">Country: </label>
    <input type="radio" id="country"/> Ireland
    <input type="radio" id="country"/> UK
    <input type="radio" id="country"/> France 
    <input type="radio" id="country"/> Italy
    <input type="radio" id="country"/> Spain
    
    </form>
    
    </body>
    </html>
    
    


Comments

  • Registered Users, Registered Users 2 Posts: 26,584 ✭✭✭✭Creamy Goodness


    ah good old vertical-align,

    here's my go to site on it — http://phrogz.net/CSS/vertical-align/

    more in-depth look — http://css-tricks.com/almanac/properties/v/vertical-align/


  • Registered Users, Registered Users 2 Posts: 2,815 ✭✭✭SimonTemplar


    Thanks but I don't think that answers my question. I don't need text to be aligned within a container. I need the 'circle' of each radio input to be directly underneath each other with all the option aligned along the right vertical axis of the label, like http://download.oracle.com/tech/blaf/specs/standardwebwidgets/radiobuttons_verticalalign.gif


  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    With styles inline and border for vis ref
    <form>
    <section style="border:1px dashed blue;"><label for="country" style="border:1px solid red; vertical-align:top">Label</label>
    <section style="display:inline-block; align:right;"><input type="radio" id="country" />
    Ireland<br>
    <input type="radio" id="country"/>
    UK<br>
    <input type="radio" id="country"/>
    France <br>
    <input type="radio" id="country"/>
    Italy<br>
    <input type="radio" id="country"/>
    Spain</section>
    </section>
    </form>
    


  • Registered Users, Registered Users 2 Posts: 3,078 ✭✭✭onemorechance


    I had it written so I'll post anyway!
    <html>
    	<head>
    		<style type="text/css">
    			label{
    				width:100px;
    				display: block;
    				text-align: right;
    				float:left;
    				margin-right: 5px;  
    			}
    			label, input{
    				margin-bottom: 5px;    
    			}
    				#left {
    				float: left;
    			}
    				#right {
    				float: left;
    			}
    		</style>
    	</head>
    	<body>
    		<form>
    			<div id="left">
    				<label for="fname">Firstname: </label>
    				<br/>
    				<label for="sname">Surname: </label>
    				<br/>
    				<label for="country">Country: </label>
    			</div>
    			<div id="right">
    				<input type="text" id="fname"/>
    				<br/>
    				<input type="text" id="sname"/>
    				<br/>
    				<input type="radio" id="country"/> Ireland
    				<br/>
    				<input type="radio" id="country"/> UK
    				<br/>
    				<input type="radio" id="country"/> France 
    				<br/>
    				<input type="radio" id="country"/> Italy
    				<br/>
    				<input type="radio" id="country"/> Spain
    				<br/>
    			</div>
    		</form>
    	</body>
    </html>
    


Advertisement