logo
down
shadow

How to make my radio buttons have square format


How to make my radio buttons have square format

Content Index :

How to make my radio buttons have square format
Tag : html , By : UnKnownUser
Date : November 26 2020, 03:04 PM

I think the issue was by ths following , I need my radio buttons to have a square format, maintaining the background color of each one. , Remove border radius:50%;
.custom-radios div {
  display: inline-block;
}
.custom-radios input[type="radio"] {
  display: none;
}
.custom-radios input[type="radio"] + label {
  color: #333;
  font-family: Arial, sans-serif;
  font-size: 14px;
}
.custom-radios input[type="radio"] + label span {
  display: inline-block;
  width: 25px;
  height: 25px;
  margin: -1px 4px 0 0;
  vertical-align: middle;
  cursor: pointer;
  /*border-radius: 50%;*/
  border: 2px solid #fff;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.33);
  background-repeat: no-repeat;
  background-position: center;
  text-align: center;
  line-height: 25px;
}
.custom-radios input[type="radio"] + label span img {
  opacity: 0;
  transition: all 0.3s ease;
}
.custom-radios input[type="radio"]#color-3 + label span {
  background-color: #f1c40f;
}
.custom-radios input[type="radio"]#color-4 + label span {
  background-color: #e74c3c;
}
.custom-radios input[type="radio"]:checked + label span img {
  opacity: 1;
}
<div class="custom-radios">
  <div>
    <input type="radio" id="color-3" name="color" value="color-3">
    <label for="color-3">
      <span>
        <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/242518/check-icn.svg" alt="Checked Icon" />
      </span>
    </label>
  </div>

  <div>
    <input type="radio" id="color-4" name="color" value="color-4">
    <label for="color-4">
      <span>
        <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/242518/check-icn.svg" alt="Checked Icon" />
      </span>
    </label>
  </div>
</div>

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

How to make Struts radio tag create a vertical list of radio buttons


Tag : java , By : Mihai Mocanu
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I'm using a struts radio tag that is being populated with a list of objects that have two fields: , its actually simple, i mean use theme simple :)
<s:iterator value="myList"> 
  <s:radio theme="simple" name="someNameToSubmit" list="#{id:name}"/><br>
</s:iterator> 

How to display Images in Android on Runtime & make radio buttons as radio groups in List


Tag : java , By : firebasket
Date : March 29 2020, 07:55 AM
will be helpful for those in need For each row in the list get the radioButton and add it to the RadioGroup. You might have to create all the radioButton's upfront and store them in a list.Set them in the ContentView depending on the position

Make radio group labels display nicely inline with radio buttons using pure CSS


Tag : html , By : wpoch
Date : March 29 2020, 07:55 AM
I wish this helpful for you Previously I used a table to display radio buttons with labels. Now I am trying to do this same thing using only CSS. , Historically, you could use margins to achieve this layout:
.controls label {
    display: inline-block;
    width: 90px;
    height: 20px;
    text-align: center;
    vertical-align: top;
    padding-top: 40px;
}
.controls input {
    display: block;
    margin: 0 auto -40px;
}
<div class="controls">
  <label class="radio">
    <input type="radio" name="foo" value="1">
    Never
  </label>
  <label class="radio">
     <input type="radio" name="foo" value="2">
  </label>
  <label class="radio">
    <input type="radio" name="foo" value="3">
    Sometimes
  </label>
  <label class="radio">
    <input type="radio" name="foo" value="4">
  </label>
  <label class="radio">
    <input type="radio" name="foo" value="5">
    Frequently
  </label>
</div>
.controls {
  display: flex;
}

.radio {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
<div class="controls">
  <label class="radio">
    <input type="radio" name="foo" value="1">
    Never
  </label>
  <label class="radio">
     <input type="radio" name="foo" value="2">
  </label>
  <label class="radio">
    <input type="radio" name="foo" value="3">
    Sometimes
  </label>
  <label class="radio">
    <input type="radio" name="foo" value="4">
  </label>
  <label class="radio">
    <input type="radio" name="foo" value="5">
    Frequently
  </label>
</div>

Styling radio buttons into a square


Tag : jquery , By : Thaweesak Suksuwan
Date : March 29 2020, 07:55 AM
it should still fix some issue You dont need to style a radio button. Just use a div:
Example in a fiddle: http://jsfiddle.net/kLGf4/2/
 <section>
    <header>
         <h1>Perfered Method of Contact</h1>

    </header>
    <div> <span>Choice 1</span>

        <div class="square-radio square-radio--clicked">
             <div class="square-radio--content"></div>
        </div>
    </div>
    <div> <span>Choice 2</span>

        <div class="square-radio">
            <div class="square-radio--content"></div>
        </div>
    </div>
</section>
.square-radio {
    border: 1px solid black;
    margin: 2px;
    width: 40px;
    height: 40px;
    position: relative;

}
.square-radio--clicked .square-radio--content{
    margin: auto;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background-color: black;
    width: 20px;
    height: 20px;
}
$(document).ready(function () {
    $(document).on("click", ".square-radio", function () {
        $(this).toggleClass("square-radio--clicked");
    });
});

WPF: Styling radio buttons into a square


Tag : chash , By : Edwin
Date : March 29 2020, 07:55 AM
I wish this helpful for you To style the RadioButton the way you want it, you'll need to change its ControlTemplate to a custom one. This link has a sample ControlTemplate. I've adapted it so that the RadioButton shows up as a square. It's a simplified ControlTemplate in that it has no animations:
<Style x:Key="SquareRadioButton" TargetType="{x:Type RadioButton}">
    <Setter Property="SnapsToDevicePixels" Value="true" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="FocusVisualStyle" Value="{DynamicResource RadioButtonFocusVisual}" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type RadioButton}">
                <BulletDecorator Background="Transparent">
                    <BulletDecorator.Bullet>
                        <Grid Width="13" Height="13">
                            <Rectangle
                                x:Name="Border"
                                StrokeThickness="1"
                                Stroke="Black"
                                Fill="White"
                                />
                            <Rectangle
                                x:Name="CheckMark"
                                Fill="Black"
                                Visibility="Collapsed"
                                Margin="2"
                                />
                        </Grid>
                    </BulletDecorator.Bullet>
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                            <VisualState x:Name="Normal" />
                            <VisualState x:Name="MouseOver" />
                            <VisualState x:Name="Pressed" />
                            <VisualState x:Name="Disabled">
                                <Storyboard>
                                    <ColorAnimationUsingKeyFrames
                                        Storyboard.TargetName="Border"
                                        Storyboard.TargetProperty="Stroke.Color"
                                        >
                                        <DiscreteColorKeyFrame KeyTime="0" Value="LightGray" />
                                    </ColorAnimationUsingKeyFrames>
                                    <ColorAnimationUsingKeyFrames
                                        Storyboard.TargetName="CheckMark"
                                        Storyboard.TargetProperty="Fill.Color"
                                        >
                                        <DiscreteColorKeyFrame KeyTime="0" Value="LightGray" />
                                    </ColorAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                        <VisualStateGroup x:Name="CheckStates">
                            <VisualState x:Name="Checked" >
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames
                                        Storyboard.TargetName="CheckMark"
                                        Storyboard.TargetProperty="(UIElement.Visibility)"
                                        >
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Unchecked" />
                            <VisualState x:Name="Indeterminate" />
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <ContentPresenter
                        Margin="4,0,0,0"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Left"
                        RecognizesAccessKey="True"
                        />
                </BulletDecorator>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
<RadioButton Style="{StaticResource SquareRadioButton}" Content="Option 1" />
Related Posts Related QUESTIONS :
  • CSS Three Tone Diagonal Background
  • How to use slots inside of template components in HTML
  • Using span tags in meta description & title, for dual languages
  • How to make an icon/span selectable by pressing Tab key?
  • Add dynamic margins using UI Kit
  • Add margin-top to textbox
  • What is the correct semantic HTML markup for a title (book, movie, etc.), according to the spec? Is it an <em> tag
  • How to make an animation in Geoserver or in Leaflet
  • Buttons overlapping when shrinking window
  • Stretch an element to the end of the automatically calculated grid, not just the explicit grid
  • What relation is there between Angular's <ng-content> and ShadowDOM
  • CSS background for div element is not working
  • CSS Marquee: multiple paragraphs overlaps
  • I want to align search bar to extreme right
  • Getting blank white space to the left of content inside pre tags
  • My viewer.html won't load any css and jss files
  • How to apply multiple styles to HTML to only part of a title?
  • Want to make text div transparent on a parallax area
  • Is there a way to make this ID plus descendants CSS rule less specific?
  • Is there a way to drop in a stylesheet to get a Material theme or similar for all form elements on the page?
  • How do I make a sideways L look in html/css?
  • Why won't the color #e67d22e1 display in Safari?
  • How to select specific tag's attribute value with xPath?
  • How to make div rows fill available height
  • How to fix text inside a block that grows
  • svg hexagon halftone pattern
  • How to edit a website's element's background colors using a chromium extention
  • What is the main tag in HTML5 ? How does it differ from body tag?
  • My image is flowing out from my div column. How I can fix it and made the image full-size into div
  • How to draw line in react
  • Why Transition css is not working in child selector css
  • How to modify materialize css select option?
  • How to center some text in a rectangle in CSS?
  • How do I equally space out css grid columns?
  • How to make sure all the parts of a macro are running correctly?
  • How to adjust the zoom of website at different browser at different screen size?
  • Can't set max height on child div properly
  • Why background color is not applying to DIV container?
  • Need to select the first-child
  • No space between attributes in buttons
  • How can I block google from crawling my page, but still let Baidu do it?
  • Rendering html content in matToolTip (Angular)
  • Embedding an iframe when iframe height is variable
  • How to use 'word-break: break-word' with link inside of text?
  • How I can animate circular progress bar from left to right?
  • Angular 6 - How can I hide a div onclick of outside of that div
  • How to fill an inline-block div with a solid color?
  • Form file doesn't align with rest of form
  • How to trim off left and right sides of image evenly as I reduce my screen size? (@media query)
  • How can I password protect a section of a static website?
  • Move a div up when I hover over it
  • Why is "align" not a valid attribute of div but still works?
  • Behavior with height/minHeight and display:flex
  • How can i change my h2 title to <p> text while keeping size and alignment?
  • Hover on the text to change size using CSS
  • How to keep a grid of cols without breaking on a new row?
  • Why is bottom: 0 not enough to move ::after content directly below main content?
  • Why does a React build need to be served? Why can't I just open it in the browser?
  • What is the proper way to target the tab key 'highlight' events on an html element?
  • How to Implement dot and line below the text in CSS?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com