[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 969
  • Last Modified:

flat radio buttons with css?

Hello

I would like to have radio buttons with flat borders with css technology.
With textfields, I can do this with border:1px solid [#color]. But it seems that this doesn't work for radio buttons. I also searched with google but didn't find anything...

Does someone know how to make flat radio buttons with css?

thank you,
saimen
0
saimenCH
Asked:
saimenCH
1 Solution
 
mosphatCommented:
AFAIK it can't be done with css only.

An option would be to use 2 images and a bunch of javascript. The 2 images of course representing a checked and unchecked flat radiobutton.
You would get something like this:
<script>
      function toggleRadioBtn(e) {
            if (e.src == "http://127.0.0.1/assets/img/radioButtonChecked.gif") {
                  e.src = "http://127.0.0.1/assets/img/radioButtonUnchecked.gif";
                  document.forms[0].radioBtn1.value = 1;
            } else {
                  e.src = "http://127.0.0.1/assets/img/radioButtonChecked.gif";
                  document.forms[0].radioBtn1.value = 0;
            }
      }
</script>
<form>
      <img src="/assets/img/radioButtonUnchecked.gif" onclick="toggleRadioBtn(this);">
      <input type="hidden" name="radioBtn1" value="0"/>
</form>
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now