Onclick radio buttons to change background color

We are displaying two radio buttons in page…. Click on Radio buttons, it will change background color, need review on quality of code, is there any way to improve ?

html, body {   width: 100%;   height: 100%;     margin: 0;   padding: 0;   text-align: center; }  body {   box-sizing: border-box;   padding-top: 180px;   background: #ffffff; }  input {   display: none; }  .button {   display: inline-block;   position: relative;   width: 50px;   height: 50px;   margin: 10px;   cursor: pointer; }  .button span {   display: block;   position: absolute;   width: 50px;   height: 50px;   padding: 0;   top: 50%;   left: 50%;   -webkit-transform: translate(-50%, -50%);   -ms-transform: translate(-50%, -50%);   -o-transform: translate(-50%, -50%);   transform: translate(-50%, -50%);   border-radius: 100%;   background: #eeeeee;   box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);   transition: ease .3s; }  .button span:hover {   padding: 10px; }  .orange .button span {   background: #FF5722; }  .amber .button span {   background: #FFC107; }   .layer {   display: block;   position: absolute;   width: 100%;   height: 100%;   top: 0;   left: 0;   background: transparent;   /*transition: ease .3s;*/   z-index: -1; }  .orange input:checked ~ .layer {   background: #F4511E; }  .amber input:checked ~ .layer {   background: #FFB300; }
<body>   <label class="orange">   <input type="radio" name="color" value="orange">   <div class="layer"></div>   <div class="button"><span></span></div> </label>  <label class="amber">   <input type="radio" name="color" value="amber">   <div class="layer"></div>   <div class="button"><span></span></div> </label>   </body>

Why did early telephones use a rotary dial instead of 10 individual buttons?

I was watching a video of little kids trying to figure out how to use a rotary phone, and it was not immediately clear to any of them how the rotary mechanism was supposed to work. That got me thinking: why was the rotary mechanism used in phones at all? It seems like individual buttons would be more intuitive to everyone and might even have less mechanical problems than a thing that has to rotate thousands and thousands of times over it’s lifetime. Why was that design choice made, why were they popular, and why did they stick around so long even after phones with buttons came on the market?

edit: The first touch tone phone was introduced by AT&T in 1963. Even thought integrated circuits weren’t practical for commercial use at that time, apparently transistors were:

By the early 1960s, low-cost transistors and associated circuit components made the introduction of touch-tone into home telephones possible. Extensive human factors tests determined the position of the buttons to limit errors and increase dialing speed even further. The first commercial touch-tone phones were a big hit in their preview at the 1962 Seattle World’s Fair. (1)

The fact that Bell Labs had invented the transistor probably helped that process along. And I understand that the change in how telephone networks worked (from pulse dialing to DTMF) drove a change in the electrical design of phones. But while transistors let them make that protocol change, was it really impossible to implement pulse dialing using buttons but not transistors? From Wikipedia:

In the 1950s, AT&T conducted extensive studies of product engineering and efficiency and concluded that push-button dialing was preferable to rotary dialing (2).

That suggests the designers didn’t know that buttons were better than a dial (if they did know, why would they have done extensive studies?). It also suggests that it WAS possible to make a phone with buttons. They would have had to build button prototypes for their studies, right?

(1) http://www.corp.att.com/attlabs/reputation/timeline/64touch.html

(2) https://en.wikipedia.org/wiki/Push-button_telephone

Google Sheet – Convert hyperlinks to buttons

In Google Sheets, I have a column of active hyperlinks. When you hover over one of them, a tool tip appears that contains an “open link” icon that you can click on to open a new tab that loads the url.

In each cell, instead of showing the entire URL, I’d like to replace that text with a “view” button that can be clicked immediately, without having to wait for the hover-delayed tool-tip with the “open link” icon.

Keep in mind, that each URL is different (in this column) and I’m looking for a solution where I can highlight all of them and convert each to a button that opens its respective url in a new browser-tab.

Is this feature available?

Unable to put text in center of circular buttons

I’m trying to design a web page which contains three round buttons with some text in them. But, the problem is I couldn’t arrange the text to be at the center of the buttons. The text is horizontally centered. But, it is not vertically centered. This is the screenshot of the output: Screenshot

Below is the css used:

button{ width: 10%; height: 0; margin-left: auto; margin-right: auto; padding-bottom: 10%; border-radius: 50%; border: 2px solid #f5f5f5; box-shadow: 0 0 3px gray; vertical-align: middle; text-align: center; } button:hover{     background-color: #E9D66B; } 

What is the best terminology to use on a modal’s buttons when a user is about to leave said page?

I hope this question is not too banal. I would like to use the best terminology for a modal’s buttons.

Context: I’m building a feature for an administrative tool. The feature is on a customer profile’s dashboard which contains items that link to other administrative tools ultimately sending the admin outside of the customer’s profile. (Changes are saved every time an Admin makes a change so there’s no risk to lose progress)

When the Admin clicks on the item, a modal pops up and says “You’re about to leave this profile to x page. Are you sure you want to leave?”

Option for buttons Stay on Page Continue | Cancel Continue | Cancel yes

Is there one in particular that is more commonly used? thank you for your time.

Flask – Using buttons to loop through image array

I’m staring out in Flask, and am trying to create a local site (just to be run at home on an RPi) to show images in a directory.

Before I keep going and go down some rabbit holes, I’m concerned there’s a better way to do this. I’m currently using two buttons within a form to go to the next or previous image.

However, in addition to checking the if "next_photo" in request.form, I’ve seen that you could perhaps instead set a formaction on the button, and handle the next/previous photo generation that way.

It feels especially kludgy as I get to the next_photo/prev_photo detection…

Thanks very much for any ideas!


<!DOCTYPE html> <html> <head>     <meta charset="utf-8">     <title>{{ title }}</title> </head> <body>     <form method="post">         <input type="submit" value="Show prev photo" name='prev_photo'>         <input type="submit" value="Show next photo" name='next_photo'>         <input formaction='/test' type="submit" value="test" name='test'>     </form>     <h2>{{ photo_index }}</h2>     <img src="{{ url_for('static', filename=images[photo_index]) }} " width="20%"> </body> </html> 


import os from flask import render_template, url_for, request  # noqa from app import app  IMAGE_FOLDER = r"C:/User/Test"  CUR_PHOTO_INDEX = 0   def create_urls(files):     image_urls = []     for file in files:         if file.endswith(".jpg"):             image_urls.append(file)     return image_urls   def photo_index(num):     if num >= len(image_urls) - 1:         return 0     else:         num += 1         return num   images = os.listdir(IMAGE_FOLDER) image_urls = create_urls(images)   # To generate new photo @app.route("/", methods=["GET", "POST"]) @app.route("/index", methods=["GET", "POST"]) def next_photo_button():     global CUR_PHOTO_INDEX     if request.method == "POST":         if 'next_photo' in request.form:             CUR_PHOTO_INDEX = photo_index(CUR_PHOTO_INDEX)         elif "prev_photo" in request.form:             if CUR_PHOTO_INDEX == 0:                 CUR_PHOTO_INDEX = len(image_urls) - 1             else:                 CUR_PHOTO_INDEX = CUR_PHOTO_INDEX - 1     print("Showing index", CUR_PHOTO_INDEX)     return render_template('index.html',                            title="Local Image Viewer",                            photo_index=CUR_PHOTO_INDEX,                            images=image_urls)   @app.route("/test", methods=['GET', 'POST']) def use_formaction():     # This will return the index page, but I can't use the     # buttons anymore for some reason...I assume because      # the URL remains and I would have to remove     # `/test` somehow...     return render_template('index.html',                            title="This works too!!!",                            photo_index=CUR_PHOTO_INDEX,                            images=image_urls) 

Here’s a .gif of the page in action.

enter image description here

Note: I am learning Python and am trying to do this with Flask. I know jQuery/Javascript is another option, but I am trying to stick to Flask unless it’s very common to mix the two in the “real world”.

Placement of More Information/Help Icon button for Radio Buttons

Throughout our system we are going to be standardizing when and how more information/help is used on specific input fields.

In general the standard will be to have the icon/button follow the field like so: enter image description here

enter image description here

I am wondering where the placement should be for radio buttons? The more information/help will be referencing the radio set as a whole.

These are the potential options and I am wondering what would follow best practices for radio buttons and more information/help?

enter image description here

How to increase time of holding buttons to take screen shot on Samsung Note 8

I have looked around online and not found an answer since the question seems too specific! My phone is a Samsung Galaxy Note 8.

I find that even a quick accidental press of volume down and power button causes a screenshot (this seems to happen a lot more often than one would expect). Is there any way to increase the time one would need to hold the buttons down in order to take the screenshot? Thanks!

Como agrupar radio buttons


Estou querendo fazer uma forma que esses radio buttons fiquem com o mesmo name dentro de um form, mas que sejam marcados por pergunta.

Pois vou enviar este formulário para um PHP e pegar lá ele como array, essas perguntas vão vir do banco de dados, portanto não coloco nomes diferentes pois pode ser que tenha 2 perguntas ou 30 perguntas, não há como eu deixar predefinido no PHP quantas questão e quais os nomes vão vir pelo POST.

<div class="col-12">   <div class="form-row">     <div class="form-group">       <label>Pergunta 1</label>       <input type="radio" name="radio">       <input type="radio" name="radio">       <input type="radio" name="radio">       <input type="radio" name="radio">       <input type="radio" name="radio">     </div>   </div>   <div class="form-row">     <div class="form-group">       <label>Pergunta 2</label>       <input type="radio" name="radio">       <input type="radio" name="radio">       <input type="radio" name="radio">       <input type="radio" name="radio">       <input type="radio" name="radio">     </div>   </div> </div>

Alguém me ajuda, por favor?