Set width of native html5 date and time pickers on iOS devices - ios

I'm using the native date and time pickers with type=date and type=time for the mobile version of a website I'm working on. The input fields are not respecting the css I have, though.
Desktop:
iOS devices:
Essentially I need the two date and time inputs to fill ~50% of the width. This is the html and css I'm using:
<div class="arriveWrapper">
<div class="arriveDateWrapper fieldWrapper">
<input class="arriveDate" name="arriveDate" type="date" placeholder="What date?" />
</div>
<div class="arriveTimeWrapper fieldWrapper">
<input class="arriveTime" name="arriveTime" type="time" placeholder="What time?" />
</div>
<div class="clear"></div>
</div>
.arriveDateWrapper {
width: 49%;
margin-right: 2%;
float: left;
position: relative;
}
.arriveDate {
width: 100%;
height: 28px;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.arriveTimeWrapper {
width: 49%;
float: left;
}
.arriveTime {
width: 100%;
height: 28px;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
If anyone can tell me how to get the placeholders to show up when using the native date/time pickers that would be great, as well.
Thanks!

Just add this to your styles
.arriveDate, .arriveTime {
-webkit-appearance: none;
-moz-appearance: none;
}
The reason behind this is that IOS device render by default the inputs using the IOS buttons

To avoid losing any style elements applied to other input boxes, use textfield instead of none.
.arriveDate, .arriveTime {
-webkit-appearance: textfield;
-moz-appearance: textfield;
}
Also, if you just want to make all the date fields appear like textboxes but still work like date fields...
input[type="date"]
{
display:block;
-webkit-appearance: textfield;
-moz-appearance: textfield;
min-height: 1.2em;
}

Related

checkbox color in Microsoft Edge

I'm working on porting my Chrome extension to Edge for wider availability - everything seems to run fine, except for the styling of the checkboxes. In Chrome, the default styling is a blue color, which works well for the look of the extension, but now the checkbox is grey in Edge. I've tried a few different ways to set the color (in JS styling, HTML, CSS) and nothing seems to work - anyone have experience with styling the color of a checkbox in Edge?
Setting the color of the checkbox alone may not work. I recommend you to try to design a custom checkbox.
This is a simple example:
/* The container */
.container {
display: block;
position: relative;
padding-left: 35px;
margin-bottom: 12px;
cursor: pointer;
font-size: 17px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Hide the browser's default checkbox */
.container input {
position: absolute;
opacity: 0;
cursor: pointer;
height: 0;
width: 0;
}
/* Create a custom checkbox */
.checkmark {
position: absolute;
top: 0;
left: 0;
height: 16px;
width: 16px;
background-color: #eee;
}
/* On mouse-over, add a grey background color */
.container:hover input ~ .checkmark {
background-color: #ccc;
}
/* When the checkbox is checked, add a blue background */
.container input:checked ~ .checkmark {
background-color: #2196F3;
}
/* Create the checkmark/indicator (hidden when not checked) */
.checkmark:after {
content: "";
position: absolute;
display: none;
}
/* Show the checkmark when checked */
.container input:checked ~ .checkmark:after {
display: block;
}
/* Style the checkmark/indicator */
.container .checkmark:after {
left: 4px;
top: 0px;
width: 5px;
height: 10px;
border: solid white;
border-width: 0 3px 3px 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
<h1>Custom Checkboxes</h1>
<label class="container">
check value
<input type="checkbox" checked="checked">
<span class="checkmark"></span>
</label>
You can also modify its size or position according to your own requirements. For more details, you could also refer to How TO - Custom Checkbox.
Starting with version 93, Edge supports the accent-color CSS property.
The accent-color CSS property sets the accent color for user-interface controls generated by some elements.
Browsers that support accent-color currently apply it to the following HTML elements:
<input type="checkbox">
<input type="radio">
<input type="range">
<progress>
It can be used as follows:
input[type="checkbox"] {
accent-color: dodgerblue;
}
<input id="clickme" type="checkbox" checked><label for="clickme">Click Me</label>

css input number field rendering weird on certain versions of ios

The input number field doesn't render properly on ios. The number gets cut off at the bottom. It works for certain ios versions but not other ones. I'm stuck, please help
input[type=submit] {
text-align: center;
}
.page_q3 input[type="number"] {
height: 91px;
width: 110px;
color: #464356;
font-family: "Source Sans Pro";
font-size: 82px;
font-weight: 600;
text-align: center;
border: none;
border-bottom: 2px solid #464356;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
<div class="page_q3">
<div class="div_minus"><img src="<?=$templateDir?>/images/minus.jpg" class="minus" data-quantity="minus" data-field="<?=$inputName?>" /> </div>
<div class="div_number"><input type="number" id="<?=$inputName ?>" name="<?=$inputName?>" value="<?=$_SESSION[$inputName]?>" placeholder="0" /> </div>
<div class="div_plus"><img src="<?=$templateDir?>/images/plus.jpg"
class="plus" data-quantity="plus" data-field="<?=$inputName?>" /> </div>
</div>
What it should look like
https://ibb.co/y8msSpL
what it actually looks like
https://ibb.co/rkbyPF5
You might want to try removing the border-radius and padding that are added by iOS by default:
.page_q3 input[type="number"] {
-webkit-border-radius: 0;
border-radius: 0;
padding: 0;
}

input radio don't work on ios touch devices (vue js app)

i am developing a web app who have custom input radio checkboxes that are not selectable using ios devices (ipad and iphone), i have alredy put the onclick="" event on labels but still nothing, does anybody have the idea how to solve this problem?
here the demo url:
http://www.mixink.it/ascom/altopiemonte/
HTML
<input
type="radio"
v-bind:id="['gialla-'+index]"
name="serviziGialla"
v-bind:value="servizio.nomeServizio"
v-model="giallaPicked"
v-on:click="AddServizi(servizio.selected,servizio.classe,servizio.nomeServizio,servizio.descrizione,servizio.descrizione_lunga,index,servizio.x,servizio.y)"/>
<label onclick=""
v-bind:for="['gialla-'+index]"
><span></span>
</label>
CSS
label span {
pointer-events: none;
}
#ylwLine input[type="radio"] + label span {
background:url(../img/yellow-off.svg);
background-repeat: no-repeat;
background-position: center center;
width: 40px;
height: 40px;
pointer-events: none;
}
#ylwLine input[type="radio"]:checked + label span {
background:url(../img/yellow-on.svg) !important;
background-repeat: no-repeat;
width: 40px;
height: 40px;
pointer-events: none;
}
hmm.. Try to get rid of all the "cursor: move" in parents or add handlers in code js
$("#ylwLine label").onclick = function () {};

iphone css display table wont allow text copy

I am developing a mobile web app with JQuery Mobile. I have some divs that are laid out as a table using display table, row, cell.
<div class="table detail">
<div>
<div class="detailHeadings">Expiration:</div>
<div class="detailValues">#{viewBean.expiration}</div>
</div>
<div>
<div class="detailHeadings">ID:</div>
<div>#{viewBean.Id}</div>
</div>
<div>
<div class="detailHeadings">Email:</div>
<div class="detailValues">#{viewBean.email}</div>
</div>
<div>
<div class="detailHeadings">ZIP Code:</div>
<div class="detailValues">#{viewBean.zipCode}</div>
</div>
</div>
With the following css:
.table {
display: table;
width: 100%;
color: #333333;
table-layout: fixed;
}
.table > div {
display: table-row;
}
.detail .detailValues {
text-overflow: ellipsis;
overflow: hidden;
display: table-cell;
white-space: nowrap;
}
.detailHeadings {
font-weight: bold;
padding-right: 10px;
width: 30%;
display: table-cell;
}
This works fine, however I want to be able to copy just the Id. When I do a long press on windows phone or android I can select the id just fine. However, on iOS it only allows me to select the entire table. This is a problem anytime I use display:table. Is there a way to let iOS know what I want to be able to copy?
Add the below to your CSS:
.table div .detailHeadings, .table div:not(:nth-child(2)) .detailHeadings + div {
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
}

Mobile Safari shows hidden back face when in tab view

I made a simple flippable element using common techniques and found some strange behavior in Mobile Safari on iOS 7 (older version also may be affected, unfortunately I can't test them at the moment older versions also seem to be affected), please see the images below or visit a demo directly on your iOS device.
Editable markup and stylesheet
Full screen view to visit on your iOS device
<div class="flippable">
<input id="flippable-trigger" type="checkbox">
<label for="flippable-trigger" class="flippable-faces">
<div class="flippable-face-front">
Front
</div>
<div class="flippable-face-back">
Back
</div>
</label>
</div>
body {
font: 1em/0 Arial;
background-color: silver;
}
.flippable {
position: relative;
float: left;
width: 10rem;
height: 10rem;
-webkit-perspective: 800;
}
.flippable input[type="checkbox"] {
display: none;
}
.flippable-faces,
.flippable-face-front,
.flippable-face-back {
position: absolute;
width: 100%;
height: 100%;
}
.flippable-faces {
-webkit-transform-style: preserve-3d;
-webkit-transition: 600ms;
}
.flippable-face-front,
.flippable-face-back {
position: absolute;
width: 100%;
height: 100%;
line-height: 10rem;
text-align: center;
-webkit-box-shadow: 0 0 1rem gray;
-webkit-backface-visibility: hidden;
}
.flippable-face-front {
color: black;
background-color: white;
}
.flippable-face-back {
color: white;
background-color: black;
-webkit-transform: rotateY(180deg);
}
.flippable input[type="checkbox"]:checked ~ .flippable-faces {
-webkit-transform: rotateY(180deg);
}
It appears that repositioning your divs fixes the issue. I don't have an answer as to why that was happening though. Sorry. Working Example | Example for iPhone
<div class="flippable">
<input id="flippable-trigger" type="checkbox" >
<label for="flippable-trigger" class="flippable-faces">
<div class="flippable-face-back">
Back
</div>
<div class="flippable-face-front">
Front
</div>
</label>
</input>
</div>

Resources