Mysteriously Bold Font CSS3 - html

I am using a webfont (poly) on my page on several buttons. In firefox, everything appears right, but in Chrome the first button's font seems bolder than the others despite using the same CSS3 code (unless I'm missing a typo).
http://ashgavs.cloudant.com/site/_design/AshGavsCouch/betcha/index.html
thats the page, look at Login vs. Login with facebook or Sign up. It's not the length of the text that's affecting the font weight, tested that already.
here's the CSS for the first and second buttons:
#login{
position: absolute;
top: 137px;
left: 19px;
padding-top: 10px;
padding-bottom: 10px;
border-top: 1px solid #aff797;
background: #369942;
background: -webkit-gradient(linear, left top, left bottom, from(#27ca3d), to(#369942));
background: -webkit-linear-gradient(top, #27ca3d, #369942);
background: -moz-linear-gradient(top, #27ca3d, #369942);
background: -ms-linear-gradient(top, #27ca3d, #369942);
background: -o-linear-gradient(top, #27ca3d, #369942);
-webkit-border-radius: 11px;
-moz-border-radius: 11px;
border-radius: 5px;
-webkit-box-shadow: rgba(0,0,0,.7) 0 1px 0;
-moz-box-shadow: rgba(0,0,0,.7) 0 1px 0;
box-shadow: rgba(0,0,0,.7) 0 1px 0;
text-shadow: 0 1px 0 #91d99a;
color: #0e5817;
font-size: 24px;
font-family: 'Poly', serif;
text-decoration: none;
vertical-align: center;
width: 229px;
}
#loginFB{
position: absolute;
top: 196px;
left: 19px;
padding-top: 10px;
padding-bottom: 10px;
border-top: 1px solid #65a9d7;
background: #3e779d;
background: -webkit-gradient(linear, left top, left bottom, from(#65a9d7), to(#3e779d));
background: -webkit-linear-gradient(top, #65a9d7, #3e779d);
background: -moz-linear-gradient(top, #65a9d7, #3e779d);
background: -ms-linear-gradient(top, #65a9d7, #3e779d);
background: -o-linear-gradient(top, #65a9d7, #3e779d);
-webkit-border-radius: 11px;
-moz-border-radius: 11px;
border-radius: 5px;
-webkit-box-shadow: rgba(0,0,0,.7) 0 1px 0;
-moz-box-shadow: rgba(0,0,0,.7) 0 1px 0;
box-shadow: rgba(0,0,0,.7) 0 1px 0;
text-shadow: 0 1px 0 #7ca9c7;
color: #0e3458;
font-size: 24px;
font-family: 'Poly', serif;
text-decoration: none;
vertical-align: center;
width: 229px;
}
Both buttons inherit properties from the same divs, so that can't be the issue either. Thanks.
--Ashley

It may be with your particular browser. Regardless, a very good thing to do (pretty much a requirement these days) is to add a CSS Reset before your own CSS definitions. Just Google "CSS Reset". You will see a lot of results. Basically it removes browser specific formatting so that your CSS is the only effective formatting on the page. No unexpected changes or additions from the browser. Often doing this will solve the kinds of issues you describe. You might want to research the idiosyncrasies of your browser, but to save time just try the reset first.

Related

How can I vertically align the text on these CSS buttons?

JSFiddle: https://jsfiddle.net/u7Lm5sjp/
I have some links like:
<div class="splash_button_row">
<span>
label 4 label 4 label 4
label 2
label 5 label 5label 5
label 5 label 5label 5label 5 label 5label 5
</span>
</div>
and a while bunch of .css like:
.splash_button {
background: linear-gradient(to bottom, #3498DB, #2980B9) repeat scroll 0% 0% #3498DB;
border-radius: 30px;
text-shadow: 6px 4px 4px #666;
box-shadow: 2px 2px 3px #666;
font-family: Georgia;
color: #FFF;
padding: 10px 20px;
border: 2px solid #216E9E;
text-decoration: none;
display: inline-block;
margin: 10px;
white-space: normal !important;
word-wrap: break-word;
max-width: 130px !important;
text-align: center;
font-size: 20px;
height: 65px;
vertical-align: middle;
}
The key fiddly bits here being:
height: 65px;
vertical-align: middle;
These two properties seem to be fighting one another. if I set vertical-align: middle; the text is all aligned, and the padding is evenly drawn around it(which is what I want). But when I then set height: 65px; to also make all of the buttons the same size, the text seems to get pushed to the top of the button.
How can I have all of the buttons the same (set) size, but also have the text within them vertically aligned to the center of the 'button'?
Edit:
I've read this question but it doesn't answer my question. My buttons have multiple lines, so the tricks with line-height don't work, and my buttons need to be in-line elements, so the tricks with flex don't work. Also my buttons need to be spaced, but the table-solutions seem to hinder that - but i'm still playing around with this one.
Change the display to table-cell for the vertical aligm middle to work.
.splash_button_row {
display: table;
border-collapse: separate;
border-spacing: 15px;
}
.splash_button {
background: #3498db;
background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
background-image: -moz-linear-gradient(top, #3498db, #2980b9);
background-image: -ms-linear-gradient(top, #3498db, #2980b9);
background-image: -o-linear-gradient(top, #3498db, #2980b9);
background-image: linear-gradient(to bottom, #3498db, #2980b9);
-webkit-border-radius: 34;
-moz-border-radius: 34;
border-radius: 34px;
text-shadow: 6px 4px 4px #666666;
-webkit-box-shadow: 2px 2px 3px #666666;
-moz-box-shadow: 2px 2px 3px #666666;
box-shadow: 2px 2px 3px #666666;
font-family: Georgia;
color: #ffffff;
font-size: 20px;
padding: 10px 20px 10px 20px;
border: solid #216e9e 2px;
text-decoration: none;
display: table-cell;
/* TABLE-CELL */
border: solid transparent 0 10px;
margin: 10px;
white-space: normal !important;
word-wrap: break-word;
max-width: 130px !important;
text-align: center;
vertical-align: middle;
height: 65px;
/* ADD HEIGHT*/
}
<div class="splash_button_row">
<span>
label 4 label 4 label 4
label 2
label 5 label 5label 5
label 5 label 5label 5label 5 label 5label 5
</span>
</div>
.splash_button {
background: #3498db;
background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
background-image: -moz-linear-gradient(top, #3498db, #2980b9);
background-image: -ms-linear-gradient(top, #3498db, #2980b9);
background-image: -o-linear-gradient(top, #3498db, #2980b9);
background-image: linear-gradient(to bottom, #3498db, #2980b9);
-webkit-border-radius: 34;
-moz-border-radius: 34;
border-radius: 34px;
text-shadow: 6px 4px 4px #666666;
-webkit-box-shadow: 2px 2px 3px #666666;
-moz-box-shadow: 2px 2px 3px #666666;
box-shadow: 2px 2px 3px #666666;
font-family: Georgia;
color: #ffffff;
font-size: 20px;
padding: 10px 20px 10px 20px;
border: solid #216e9e 2px;
text-decoration: none;
float: none;
white-space: normal !important;
word-wrap: break-word;
max-width: 130px !important;
text-align: center;
vertical-align: middle;
**margin:10px **auto;****
**display: block;**
**height: 65px;**
**display: flex;
**justify-content: center; /* align horizontal */**
**align-items: center;****
}
Did the trick for me. See the stars. I edited my answer. I think i got what you want now.
The best way to align almost everything in CSS. You only need to use the below class.
.vertical-center{
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}

Error centering text on CSS3 button

I am trying to center the text "verksamheter" on my CSS3 button, but I can't get it to work.
HTML:
<span>Verksamheter</span>
CSS:
.verksamheter {
width: 220px;
height: 44px;
font-style: italic;
font-size: 18px;
display: inline-block;
text-align: center;
-webkit-border-radius: 22px;
-moz-border-radius: 22px;
border-radius: 22px;
background-color: #ebebeb;
-webkit-box-shadow: 0 1px rgba(0,0,0,.13), inset 0 2px rgba(255,255,255,.75);
-moz-box-shadow: 0 1px rgba(0,0,0,.13), inset 0 2px rgba(255,255,255,.75);
box-shadow: 0 1px rgba(0,0,0,.13), inset 0 2px rgba(255,255,255,.75);
border: solid 1px #4f4d6a;
background-image: -webkit-linear-gradient(top, #6e6c8a, #4f4d6a);
background-image: -moz-linear-gradient(top, #6e6c8a, #4f4d6a);
background-image: -o-linear-gradient(top, #6e6c8a, #4f4d6a);
background-image: -ms-linear-gradient(top, #6e6c8a, #4f4d6a);
background-image: linear-gradient(to bottom, #6e6c8a, #4f4d6a);
}
.verksamheter span {
vertical-align: middle;
}
The height of the <a> is 44px, so make the line-height of the text 44px as well.
http://jsfiddle.net/s4KJd/
Simply set the line-height property according to the height of the element and the font size used. For example:
.verksamheter {
line-height: 44px;
}
Here's a jsFiddle Demo.

IE css button outside border

My button works in all other browsers except IE. I thought the 'border-radius' was suppose to work for IE?
.simpleHelp {
border-top: 1px solid #ffffff;
background: #910330;
background: -webkit-gradient(linear, left top, left bottom, from(#790228),
to(#910330));
background: -webkit-linear-gradient(top, #790228, #910330);
background: -moz-linear-gradient(top, #790228, #910330);
background: -ms-linear-gradient(top, #790228, #910330);
background: -o-linear-gradient(top, #790228, #910330);
padding: 10.5px 21px;
-webkit-border-radius: 40px;
-moz-border-radius: 40px;
border-radius: 40px;
-webkit-box-shadow: rgba(0,0,0,1) 0 1px 0;
-moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
box-shadow: rgba(0,0,0,1) 0 1px 0;
text-shadow: rgba(0,0,0,.4) 0 1px 0;
color: #ffffff;
font-size: 17px;
font-family: Georgia, Serif;
text-decoration: none;
vertical-align: middle;
}
Border-radius (and, in fact, any CSS3) only works on IE9+, however, you can "retrofit" CSS3 stuff onto older versions of IE9 with a fun little library called CSS3PIE. If you really need borders and shadows in IE, then CSS3PIE is the way to go. However, letting older browsers gracefully degrade is okay to do, too.
I'm afraid that border-radius only works in IE9 and up.
http://www.findmebyip.com/litmus/

Does not work border-radius IE8

To implement the border-radius in IE8 I use border-radius.htc
The block in which to work correctly realzovat border-radius:
.mc-button
{
-moz-transition: all 0.218s ease 0s;
-moz-user-select: none;
background-color: #CBCBCB;
background-image: -moz-linear-gradient(center top , #CBCBCB, #DCDCDC);
border: 1px solid #DCDCDC;
color: #FFFFFF;
cursor: default;
display: inline-block;
font-size: 11px;
font-weight: bold;
height: 29px;
line-height: 29px;
min-width: 70px;
padding: 0 8px !important;
text-align: center;
overflow: visible;
font-family: inherit;
font-size: inherit;
float: left;
text-decoration: none;
display: block;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
-moz-outline-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
font-family: Arial, Sans-Serif !important;
behavior:url(Content/border-radius.htc);
}
According to the list of attached files - border-radius.htc connects to the page
Can you please tell how to solve the problem?
UPDATE (06/13/2012)
If the code is replaced by a button:
.mc-button
{
border: 1px solid #696;
height: 29px;
line-height: 29px;
min-width: 70px;
text-align: center;
padding: 0 8px !important;
overflow: visible;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
float: left;
display: block;
background: #00ADEE;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#00ADEE), to(#0078A5));
background: -webkit-linear-gradient(#00ADEE, #0078A5);
background: -moz-linear-gradient(#00ADEE, #0078A5);
background: -ms-linear-gradient(#00ADEE, #0078A5);
background: -o-linear-gradient(#00ADEE, #0078A5);
background: linear-gradient(#00ADEE, #0078A5);
-pie-background: linear-gradient(#00ADEE, #0078A5);
behavior: url("Content/PIE.htc");
}
and to declare as:
<a id="login_button" class="mc-button mc-button-submit ">SomeText</a>
.mc-button-submit
{
border: 0px solid #0076A3;
background: #00ADEE;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#00ADEE), to(#0078A5));
background: -webkit-linear-gradient(#00ADEE, #0078A5);
background: -moz-linear-gradient(#00ADEE, #0078A5);
background: -ms-linear-gradient(#00ADEE, #0078A5);
background: -o-linear-gradient(#00ADEE, #0078A5);
background: linear-gradient(#00ADEE, #0078A5);
-pie-background: linear-gradient(#00ADEE, #0078A5);
color: #FFFFFF;
text-align: center;
}
Rounding it disappears. Adding to the .mc-button-submit line behavior: url ("Content / PIE.htc"); does not help.
Can you please tell how to connect a second class with the parameters of the background?
Standalone .htc hack is not working for background gradient and border-radius both at the same time.
Try to replace css gradient with simple image. This trick will work.
Also you can use css3pie (thanks to #dop-trois) — this pure Javascript tool is more perfect than standalone .htc file.
PS. Inset box-shadows cannot be implemented in both solutions.
PPS: the code you need is here: (i changed it a bit to make it more valid and correct):
.mc-button {
font: bold 11px/29px Arial, Helvetica, sans-serif !important;
text-align: center;
text-decoration: none;
color: #FFFFFF;
border: 1px solid #DCDCDC;
height: 29px;
min-width: 70px;
padding: 0 8px !important;
overflow: visible;
display: block;
float: left;
/* Unique link for this gradient — http://www.colorzilla.com/gradient-editor/#cbcbcb+0,dcdcdc+100;Custom */
background-color: #CBCBCB;
background: -moz-linear-gradient(top, rgba(203,203,203,1) 0%, rgba(220,220,220,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(203,203,203,1)), color-stop(100%,rgba(220,220,220,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(203,203,203,1) 0%,rgba(220,220,220,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(203,203,203,1) 0%,rgba(220,220,220,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(203,203,203,1) 0%,rgba(220,220,220,1) 100%); /* IE10+ */
background: linear-gradient(top, rgba(203,203,203,1) 0%,rgba(220,220,220,1) 100%); /* W3C */
/* css3 stuff below: (via css3please.com) */
/* no one prefix except `-webkit` is needed nowadays for `border-radius` */
-webkit-border-radius: 5px;
border-radius: 5px;
-webkit-transition: all 0.218s ease-out;
-moz-transition: all 0.218s ease-out;
-ms-transition: all 0.218s ease-out;
-o-transition: all 0.218s ease-out;
transition: all 0.218s ease-out;
/* PIE specific accordingly http://css3pie.com/documentation/q-and-a/ */
behavior: url(PIE.htc);
}
You should be sure that you have included PIE.htc correctly (important!)
Relative questions
Using CSS3Pie htc for border-radius in IE8
CSS3 PIE - Giving IE border-radius support not working?
CSS3 PIE - Giving IE border-radius support not working?
Accordingly to answers possible problems may be in mime type ("text/x-component").
Also possible solution may be:
position: relative;
z-index: 0;
To apply gradients and border-radius, I recommend CSS3 Pie. It's the most powerful tool i know, to apply CSS3 properties in IEs.
Apply gradients in IEs):
#myElement {
background: #CCC; /*fallback for non-CSS3 browsers*/
background: -webkit-gradient(linear, 0 0, 0 100%, from(#CCC) to(#EEE)); /*old webkit*/
background: -webkit-linear-gradient(#CCC, #EEE); /*new webkit*/
background: -moz-linear-gradient(#CCC, #EEE); /*gecko*/
background: -ms-linear-gradient(#CCC, #EEE); /*IE10*/
background: -o-linear-gradient(#CCC, #EEE); /*opera 11.10+*/
background: linear-gradient(#CCC, #EEE); /*future CSS3 browsers*/
-pie-background: linear-gradient(#CCC, #EEE); /*PIE*/
behavior: url(PIE.htc);
}​
Apply border-radius in IEs):
#myAwesomeElement {
border: 1px solid #999;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
behavior: url(path/to/PIE.htc);
}​
You'll need PHP to get it work.
Live demo on CSS3 Pie's website.
Btw.: Applying border-radius & gradients the same time is possible with this tool ;)
Hope this helps :)
To apply Gradients, Box shadows and Border-radius, I recommend CSS3 Pie. I used it in cook&smile project and it fully works in IE.
*{ behavior:url(path/PIE.htc);}
.border_radius_div{ position:relative; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px;}
.gradient_div{ position:relative;
background: #EEFF99;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#EEFF99), to(#66EE33));
background: -webkit-linear-gradient(#EEFF99, #66EE33);
background: -moz-linear-gradient(#EEFF99, #66EE33);
background: -ms-linear-gradient(#EEFF99, #66EE33);
background: -o-linear-gradient(#EEFF99, #66EE33);
background: linear-gradient(#EEFF99, #66EE33);
-pie-background: linear-gradient(#EEFF99, #66EE33); }
Visit this website to explore yourself further.
http://css3pie.com
Note:
Don't forget to use position (relative or absolute) where we are using Border-radius, gradients and box shadows.
Don't forget to use behavior:url(xhtml_folder/PIE.htc);
And the important thing is don't forget to put the PIE.htc in xhtml folder.

Working with CSS3 Menu

I am presently doing a project with menus and trying to implement something which is the same menu appeared below:
And now I have got which is similar to this menu and trying to modify it but I am stucked with it.
Here is the screenshot of my menu how it looks in chrome:
And this is how it looks in IE8 and firefox:
The problem is I am able to get rounded corners but the gloss and the bump over the menu which is shown in 1st menu is not appearing in my menu as it is showing as flat in chrome,IE as well as firefox.So how do I modify in order to get the same menu as shown in 1st figure.
Here is my menu css:
.menu
{
height: 18px;
margin-left:318px;
margin-top:10px;
width:914px;
border: 1px solid #d6d6d6;
background: #fff;
padding: 14px;
text-align: center;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background: #1612CE;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#1612CE), to(#3B91F1));
background: -webkit-linear-gradient(#1612CE, #3B91F1);
background: -moz-linear-gradient(#1612CE, #3B91F1);
background: -ms-linear-gradient(#1612CE, #3B91F1);
background: -o-linear-gradient(#1612CE, #3B91F1);
background: linear-gradient(#1612CE, #3B91F1);
behavior: url(css/ie-css3.htc);
}
.blue {
background : rgb(52,119,210);
background : -webkit-gradient(linear, left top, left bottom, from(rgb(52,119,210)), to(rgb(34,98,188)));
background : -moz-gradient(linear, left top, left bottom, from(rgb(52,119,210)), to(rgb(34,98,188)));
border: 1px solid #2f8893;
}
.blue li a
{
color: #fff;
text-shadow: 0 -1px 0 rgba(0,0,0,.40);
}
a {
text-decoration: none;
color: #262626;
line-height: 20px;
}
ul
{
margin: 0;
padding: 0;
z-index: 300;
text-align:right;
}
li
{
padding: 0 10px;
display:inline-block;
}
li:first-child {
float:left;
}
This is how I'm showing it:
<div class="menu blue">
<ul >
<li class="active">Home</li>
<li>About</li>
<li>Blog</li>
<li>Services</li>
<li>Portfolio</li>
<li>Contacts</li>
<li>Back to Article</li>
<li>How it Works?</li>
</ul>
</div>
Try this combination of colors: http://jsfiddle.net/TLS3Y/4/
CSS3 Please! makes all these CSS3 rules so easy :)
.menu {
border-color: #598FD1 #598FD1 #1A53A2;
border-style: solid;
border-width: 2px 1px 3px;
height: 18px;
margin-left: 318px;
margin-top: 10px;
padding: 14px;
text-align: center;
width: 914px;
background-color: #2A72D8;
background-image: -webkit-gradient(linear, left top, left bottom, from(#2A72D8), to(#1A53A2));
background-image: -webkit-linear-gradient(top, #2A72D8, #1A53A2);
background-image: -moz-linear-gradient(top, #2A72D8, #1A53A2);
background-image: -ms-linear-gradient(top, #2A72D8, #1A53A2);
background-image: -o-linear-gradient(top, #2A72D8, #1A53A2);
background-image: linear-gradient(top, #2A72D8, #1A53A2);
-webkit-box-shadow: inset 0px 0px 9px #2A72D8;
-moz-box-shadow: inset 0px 0px 9px #2A72D8;
box-shadow: inset 0px 0px 9px #2A72D8;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;
behavior: url(css/ie-css3.htc);
}
First of all i encourage you to use Lea Verou's http://leaverou.github.com/prefixfree/ which saves you the pain of having to add all those prefixes for different browsers and makes just one linear-gradient declaration
Second you are not using the proper declarations for linear-gradient in webkit. Should be
-webkit-linear-gradient(rgb(52,119,210),rgb(34,98,188))
This is the shorthand method which you should use since you are not specifying any angles for your gradient
This is also available in FF
background: -moz-linear-gradient(rgb(52,119,210),rgb(34,98,188)); /* Firefox */
background: -webkit-linear-gradient(rgb(52,119,210),rgb(34,98,188)); /* Webkit */
For a 3d-er look add box-shadow set on inset
box-shadow:inset 0 1px 0 #fff; // for a nice thing white line at the top of the menu
You can also chain the box-shadow declarations and have
box-shadow:inset 0 1px 0 #fff, 0 2px 5px #222 // thing white line at the top and drop shadow
You can emboss the ul using box-shadow:
div.blue {
box-shadow: 2px 2px 2px #888888;
}
Gradient can be made with linear-gradient. I like the generator at http://gradients.glrzad.com/.