Why does box-sizing: padding-box look different on a mac? - html

#map-search-button {
display: inline;
float: right;
border-style: solid;
border-image: url(https://i.imgur.com/r35pKjB.png) 8 8 8 8;
border-width: 5px 5px 5px 5px;
height: 50px;
width: 125px;
background-color: #00ACC8;
background-clip: padding-box !important;
font-size: 1.5em;
text-align: center;
line-height: 40px;
color: white;
}
<div id="map-search-button">Find us!</div>
On Chrome on Windows, the button looks the way I expected:
But on Chrome on a Mac, the button looks like this:
Why is this? Is there anything in the CSS I can change that would keep the border image solid?

I’d highly recommend creating a rounded button with border-radius rather than trying to implement a border-image. See inline example below.
As for a technical explanation of why yours doesn’t look right, you may want to look into best practices for producing a border-image if you want to further pursue that route. Your Mac may have a Retina display and be improperly scaling your image.
Using border-radius:
body {
font-family: impact, sans-serif;
letter-spacing: .02em;
}
#map-search-button {
width: 125px;
height: 50px;
line-height: 50px;
background-color: #00ACC8;
border: 5px solid #00ACC8;
border-radius: 8px;
font-size: 1.5em;
text-align: center;
color: white;
}
<div id="map-search-button">FIND US!</div>

Related

Safari macOS border color

For a website I am currently developing, I run into a very big issue on safari only on mac. My input fields do have borders. I am not talking about the well known border radius issue. But as you can see in the picture below, my input fields get a black border from safari. The border however, does dissapear on focus.
I've have tried lots of things, overwriting all the regular properties in css that an input field will get from safari.
.search-posts-by-name {
-webkit-appearance: none;
border-radius: 0;
width: 400px;
grid-column: 2/3;
grid-row: 2/3;
border-style: none;
border-top-left-radius: 14px;
border-bottom-left-radius: 14px;
border-top-right-radius: 14px;
border-bottom-right-radius: 14px;
height: 28px;
background-color: #FAFAFA;
align-self: center;
margin-bottom: 20px;
color: black;
margin-top: 17.5px;
margin-left: 75px;
z-index: 3;
}
input.search-posts-by-name::placeholder {
color: #263238;
opacity: 0.6;
text-align: left;
}
.form-control-email:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px #1B5CB0 inset;
-webkit-text-fill-color: white;
background-position: 6px 12px;
}
.form-control-password:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px #1B5CB0 inset;
-webkit-text-fill-color: white;
background-position: 6px 12px;
}
<input type="search" name="search-users" placeholder="Search posts by name" class="search-posts-by-name">
Nothing seems to work.
Hope you guys can help me figure out how to fix this.
I am using the most recent version of safari.
UPDATE: the form-control-class clashed with the input and i do not understand why, since is specifically target that class. Does anybody know why and how?

Why is chrome rendering this CSS in such a way

I was trying to create a circle with i icon in it for with CSS. However, when page is first rendered the circle looks like an inverted egg and covers the border around it slightly. (Zoom in the browser to see issue in more details)
The tricky part is, if you open Dev Tools and change any value related to it's position(width, height, whatever), everything will snap back to normal and it will become a circle.
https://jsfiddle.net/2yjashje/
<div class="round-egg">
i
</div>
.round-egg {
font-size: 14px;
background: white;
color: #8DC641;
border-radius: 10px;
cursor: help;
border-bottom: none !important;
border: 4px solid #8DC641;
width: 20px;
height: 20px;
text-align: center;
}
What is going on here?
I put the letter "i" in its own span and increased the margin from top to vertically centre it. As for the circle, I modified the border-radius property, and then removed the border-bottom: none; property as well. Assuming you want a circle, you need the bottom border.
https://jsfiddle.net/2yjashje/3/
<div class="round-egg">
<span class="icon">i</span>
</div>
.round-egg {
font-size: 14px;
background: white;
color: #8DC641;
border-radius: 30px;
cursor: help;
border: 4px solid #8DC641;
width: 20px;
height: 20px;
text-align: center;
display: table-cell;
}
.icon {
display: block;
margin-top: 2px;
}

How to keep text in center on showing an image completely at background

I am trying to create a <kbd> tag for myself. I was trying with this image like below,
CSS:
kbd {
font-family: Courier;
padding-top:8px;
padding-bottom:8px;
padding-right:15px;
padding-left:10px;
background: url('kbd.png');
background-repeat:no-repeat;
}
HTML:
<p>Open Terminal <kbd>CTRL</kbd> + <kbd>ALT</kbd> + <kbd>T</kbd> </p>
But images are not showing completely unless the text is large enough to cover the image. see the screen shot below.
Also I could not able to bring the text at center, I tried align but could not succeeded.
Any help including any better way to have <kbd> tag will be appreciated.
It's very worth noting that this could be done pretty much entirely without the need of an image. It would be more flexible without it; a long <kbd> text would break if it were an image, but wouldn't if it was done entirely in CSS.
So I propose:
http://jsfiddle.net/TLV4a/1/
kbd {
display: inline-block;
min-width: 45px;
text-align: center;
font-family: Courier;
margin: 0 5px;
padding: 0 5px;
background-color: #f7f7f7;
border-width: 1px 1px 3px;
border-style: solid;
border-color: #ccc;
-webkit-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: inset 0 0 4px 1px #fff;
box-shadow: inset 0 0 4px 1px #fff;
line-height: 1.75;
}
If you have even padding, instead of different left vs. right padding, as well as utilise a min-width along with text-align: center;, you can get it to display nicely.
http://jsfiddle.net/TLV4a/
kbd {
display: inline-block;
min-width: 50px;
text-align: center;
font-family: Courier;
padding: 6px 5px 8px;
background: url('https://dl.dropboxusercontent.com/u/61772690/kbd.png') no-repeat 50% 0;
}
Have a look at this jsFiddle
kbd {
font-family: Courier;
padding-top:6px;
padding-bottom:6px;
background: url('https://dl.dropboxusercontent.com/u/61772690/kbd.png');
display: inline-block;
width: 54px;
text-align: center;
background-repeat:no-repeat;
}
You can use this code to get your desire resutl:
kbd {
background: url("kbd.png") no-repeat;
display: inline-block;
font-family: Courier;
min-height: 31px;
min-width: 54px;
font-size: 0.75em;
padding: 6px 0 0;
text-align: center;
}
/*use font size to adjust with the key image and use padding 0px for the left and right after that use text-align to obtain your best result .I have attached an image look it*/
Adding background-size may be your best solution.
background-size:100% 100%;
You can use text-align:center for align your text and on the background image you can use a z-index Property.
have a look here for z-index examples:
http://www.w3schools.com/cssref/pr_pos_z-index.asp

CSS/HTML :: alignment and button problem under IE

i have a weird bug on this page when browsing with IE
http://www.emfx.fr/?page_id=38
this image explain clearly the problem :
http://appartager.free.fr/site/bugIE.jpg
when i look at this page localy(easyPHP) with IE everything is OK
when i look at this page online with IE i have 2 problem
1) my hr tag don't align to center
2) the button send message is crop
BUT the code is exactly the same and the Browser is the same (IE)
the hr behavior is control in a css file
hr.center {
border: none;
color: #353a40;
background-color: #353a40;
height: 1px;
width: 371px;
text-align: center;
}
the button is also control by 2 css file (All Browser/IE exception)
here is the general code :
#contact_form input[type=submit] {
padding: 7px 15px;
background: rgba(255,255,255,0.1);
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
font-family: "Droid Sans", Arial;
cursor: pointer;
border: 1px solid #666;
color: #ccc;
margin-bottom: 10px;
margin-left: 420px;
}
here is the ie exception
#contact_form input[type=submit] {
padding: 8px 0px;
background: rgba(255,255,255,0.1);
margin-bottom: 300px;
margin-left: 418px;
text-align: center;
}
if you guys have any idea on how to solve this it would be great !
cheers !
sk
You've removed the horizontal padding from the button in IE
#contact_form input[type=submit] {
padding: 8px 0px; /* 15px?*/
and I'd personally center a hr using margin:auto instead of using text-align - but hr is aligned to the center by default; so you shouldn't need to adjust this.
(Taking those declarations out in IE web developer tools appears to resolve the problem).

css3 border-radius - inside is square on Chrome + Safari?

It is easiest to describe this problem with pictures. How it is meant to look (works in Firefox):
firefox
In Chrome and Safari the insides of the border are square for some reason:
chrome
Here is my CSS:
.header {
width: 850px;
margin-left: auto;
margin-right: auto;
background-color: #F7F7F7;
-moz-border-radius: 40px;
-webkit-border-radius: 40px;
border-radius: 40px 40px 40px 40px;
border: 20px solid rgba(255,255,255,0.1);
-moz-background-clip: padding;
-webkit-background-clip: padding;
background-clip: padding-box;
margin-top: 20px;
}
Any ideas?
EDIT - here is a jfiddle of it: jsfiddle.net/oliverw92/pJgyu/11262/
It's a known Webkit and Opera bug: https://bugs.webkit.org/show_bug.cgi?id=23166
Until it's fixed, your only way around it is using 2 elements I'm afraid...
If you remove the alpha from the border, it works. Since you probably don't want to do that, you may be able to use two nested elements. Example here.
I think this is normal Webkit behavior when clipping to the box's padding. The padding is square, i.e., not defined by the border's curves, and so the background color overlays portions of the border.
Try this instead (via a SPAN nested inside your DIV):
CSS:
body {
background-color: #999;
}
.header {
width: 400px;
margin-left: auto;
margin-right: auto;
-moz-border-radius: 40px;
-webkit-border-radius: 40px;
border-radius: 40px 40px 40px 40px;
border: 20px solid rgba(255,255,255,0.1);
margin-top: 20px;
height: 85px;
font-weight: 100;
font-size: 70px;
vertical-align: middle;
text-align: center;
}
.header span
{
background-color: #F7F7F7;
display: inline-block;
width:100%;
border-radius: 20px 20px;
}
HTML:
<div class="header">
<span>DataLog</span>
</div>
Side Note: Aside from your code, I didn't bother adding all the vendor prefixes; I'll leave that to you.
Or you can just use a box-shadow and adjust the top margin. My example only includes the -web-kit versions
.header {
width: 400px;
margin-left: auto;
margin-right: auto;
background-color: #F7F7F7;
-webkit-border-radius: 40px;
-webkit-box-shadow: 0px 0px 0px 20px rgba(255,255,255,0.10);
margin-top: 40px;
height: 85px;
font-weight: 100;
font-size: 70px;
vertical-align: middle;
text-align: center;
}
Here is a similar JSFiddle to your first example using only your original div
I have been experiencing a similar issue. It turned out that because the container inside the container that i have added with the border-radius has a background-colour, it covers the inside of the border.
To rectify this i have added a border-radius to the child object as well as it makes it look the same.