Failed attempt at customizing radio buttons in Ionic2

I am facing an issue with the alignment of my radio buttons. The text appears too far away from the radio button and I want to bring it closer.

Below is my code snippet:

ion-row radio-group (ionChange)="onChange($event)">
     <ion-col width-30>
       <ion-item>
           <ion-label>Yes</ion-label>
           <ion-radio value='{{checklists.controls["yesradio"].value}}-yes'>  </ion-radio>
       </ion-item>
     </ion-col>


     <ion-col width-30>

         <ion-item  style="text-align:left">
             <ion-label>No</ion-label>
              <ion-radio style="margin:0px;"  value='{{checklists.controls["yesradio"].value}}-no'></ion-radio>

       </ion-item>

     </ion-col>

 </ion-row>

The current layout looks like this https://i.sstatic.net/kgHq3.png

In the image above, you can see that the 'Yes' text is positioned quite far from the radio button for 'Yes'.

My goal is to achieve a layout similar to https://i.sstatic.net/nYYka.png

I also attempted to tweak the code by adding:

<ion-col width-30>

         <ion-item  style="text-align:left">
             <ion-label style="margin:0px;">No</ion-label>
              <ion-radio style="margin:0px;" id="no_radio"></ion-radio>  //added margin 0px fails

       </ion-item>

     </ion-col>

What additional changes can be made to ensure the text ('Yes' and 'No') align closely with the respective icons?

Answer №1

To obtain the desired outcome, you can make the following adjustments in the .scss file on your webpage.

.input-wrapper{
     flex: initial;
}

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

The autogenerated HTML5 constraints in Symfony2 are not functioning properly

I'm currently working on a project using Symfony2 (v2.3.6) and I wanted to utilize the auto-generated HTML5 constraints in my form. For this purpose, I created a simple form with just one field that has a RegEx constraint: public function formAction ...

Tips for aligning the text in a navigation bar to the center

My CSS skills are not very strong. How can I center the text "My Website" in my navbar based on this code? You can view a working example on JSFiddle here: https://jsfiddle.net/cvp8w2tf/2/ Thank you for your assistance! ...

What is the optimal unit to employ in CSS - percentages or pixels?

As someone who is not well-versed in CSS, I strive to create a design that will appear visually appealing across all browsers and screen resolutions. I have observed that certain websites construct their designs using percentages for properties like width, ...

Choose multiple table cells as a unit

In this scenario, I am looking to group select multiple cells within a table. The desired functionality includes being able to click on a target cell to select it, as well as the ability to achieve selection by clicking and dragging to cover multiple cells ...

Utilizing Node and Electron to dynamically adjust CSS style properties

Having a dilemma here: I need to access the CSS properties from styles.css within Electron. Trying to use document.getElementsByClassName() won't work because Node doesn't have document. The goal is to change the color of a specific div when the ...

Button Fails to Respond on Second Click

I have a button that triggers a JavaScript function. This function, in turn, initiates two sequential AJAX calls. Upon completion of the first call, it performs some additional tasks before proceeding to the second AJAX call. The button functions correctl ...

How can I align two inner boxes vertically in the most efficient manner?

.dd{ height:100px; width:100%; border:1px soild red; background:#000; } .dd .d1{ height:20px; width:20px; border:1px solid green; display:inline-block; } .dd .d2{ height:20px; width:20px; border:1px solid green; display:inl ...

What is the best way to incorporate two banners on the Magento homepage alongside my flexslider?

I recently made the switch from using a camera.js slider on my website to a Flexslider. The reason for this change was that I couldn't make the camera.js slider clickable, and I wanted to eliminate the 'Click here' button. However, now that ...

Styling the active selection in nav class with bold attribute in Bootstrap/AngularJs

How can I apply the bold attribute to the currently selected nav bar item? <ul class="nav"> <li role="presentation" ng-repeate="item in items" ng-class="{'active':navLink == item.header}"> </li> &l ...

An External Force is Disrupting My Jquery

Something seems off because everything was working perfectly fine until the FallingLeavesChristmas.min.js file stopped activating on this specific page. I initially thought it was an issue with the JavaScript itself, but that doesn't seem to be the ca ...

"Implementing a Modular CSS Approach and Uniform Styling Across Your App

How can we handle the scenario of implementing specific styling for h1 tags within a modular CSS approach? In the past, this would have been achieved through inheritance in a single stylesheet. For example: .h1 { font-size: 3rem; /* more styles */ } .h2 { ...

The hovering effect on the image link is causing the surrounding div to stretch too far

Whenever I hover over specific points below an image link wrapped in a div, it triggers the hovering effect for the CSS-created image link. Despite trying various solutions like overflow:hidden and display:inline-block, nothing seems to resolve this issue. ...

Activate animation while scrolling the page

I am using a progress bar with Bootstrap and HTML. Below is the code snippet: $(".progress-bar").each(function () { var progressBar = $(this); progressBar.animate({ width: progressBar.data('width') + '%' }, 1500); }); <body> & ...

"Enhance Your Form with Ajax Submission using NicEdit

Currently, I am utilizing nicEditor for a project and aiming to submit the content using jQuery from the plugin. Below is the code snippet: <script type="text/javascript"> bkLib.onDomLoaded(function() { new nicEditor().panelInstance('txt1' ...

Conceal the excess content by placing it behind a series of stacked div

Within my layout, there is a fixed div called #navigation that houses buttons. Alongside this, there is scrollable content in the form of .card elements. The #navigation div currently displays with a green background for demonstration purposes, as shown b ...

Save the value of the clicked button to a variable

Is there a way to determine which button has been clicked? I have five buttons that serve as answers. <fieldset> <legend> Question1 </legend> <input type="button" value="1st Answer"/> <input type="button" value="2nd Answe ...

Populate a form with data retrieved from a MySQL query result

One aspect of my project involves a specific interface called 'designation.php' that contains a form. The goal is for users to enter a 'designation code' (which serves as the primary key) and then click the 'update' button, pr ...

`Is there a way to generate nicely formatted SQL code programmatically using .NET?`

Does anyone know of a library or open-source project under the GPL license that can transform a SQL statement into nicely formatted HTML? I'm open to using PHP or Java code that I can adapt for use in .NET. I've searched on Google, but unfortun ...

Clicking on various buttons will trigger the opening of different tabs within a single modal window

Imagine I have two distinct buttons, A and B. Within a single modal window, there exist two tabs labeled as a and b. My goal is to be able to click on A and have tab a displayed in the modal, while clicking on B should reveal tab b within that same modal. ...

I am looking to identify when the focus event occurs on all HTML input elements on a page without using addEventListener or any HTML attributes

Does anyone know a way to detect the focus event on all HTML input elements on a page without using the addEventListener function or HTML attributes? I was successful in detecting click events with the following code: onclick = () => { // do somethi ...