I am using these css commands:
#media all and (max-width:1050px) {
body {
background:#90a830 url(img/bg.png) no-repeat left top;
background-position:-481px 0;
}
}
#media not all and (max-width:1050px) {
body {
background:#90a830 url(img/bg.png) no-repeat center top;
}
}
body {
line-height:1;
margin:0px auto;
padding:0px;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
font-family: 'roboto_condensedregular';
}
This allows me to have 2 different background settings for different screen widths, however....
In older browsers the background is blank, I am guessing its because older browsers cannot look inside the media tag.
My question is, how do i do a fallback for older browsers so if whatever browser doesnt support media tag it still falls back on some other css to show a background?
Thanks
Set the fallback backgroundstyles first, then override them for each screen size
Related
How can i change this for one browser while having it differently for another??
h2 {
font-size: 150%;
color: red;
}
Thanks. like making it blue or 175% on another
The part of solution by dude below.
#-moz-document url-prefix() {
h2 {
font-size: 150%;
color: red;
}
}
See it here
See other Firefox specific css extensions here
Simple writeup on 'Tricks' here
Edit
About other browsers: You can find a lof of useful browser-specific CSS 'hacks' on browserhacks.com
This is the website:
http://loveloverun.com/test/love_run/
I checked and it works properly in chrome and firefox. The problem is that in IE9 the background image only works on the body level.
Here is my css:
body {
font-family : Open Sans;
min-height: 0px;
background: url("../img/front/bg.png") repeat;
height:auto;
}
And the other div e.g. container
.container {
width: 1022px !important; /*1302px*/
background-color:#ffffff;
background-clip:content-box;
}
and one more example (footer):
#enquiry {
color:#ffffff;
background: url("../img/front/black.png") repeat;
}
I checked the doc type and it's not missing any tag.
And also some other places are different from the chrome / firefox one, so I wonder:
1) Are there any plugin to enhance the compatibility? I tried modernizer, but it seems to have no effect.
2) How can background problem be solved for IE9?
Update:
body {
font-family : Open Sans;
min-height: 0px;
background-image: url("../img/front/bg.png");
background-repeat: repeat;
height:auto;
}
still the same result
Update 2:
Screen cap in ie9
Use
background-image: url(/image.whatever);
instead of the
background: url (); code
I'm having problems trying to stop chrome from making the body fit the screen on here http://www.lgbtgamers.com/sessions . In Firefox it does not and it looks like the footer extends, in chrome it just leaves a white gap.
The CSS for this part:
*{
margin: 0;
padding: 0;
vertical-align: baseline;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
}
html{
font: 13px/1.4 Helvetica,arial,freesans,clean,sans-serif,"Segoe UI Emoji","Segoe UI Symbol";
font-family: 'Open Sans', sans-serif;
color: #4F565A;
background: #151515;
}
body{
background: #E5E5E5;
}
The problem seems to be missing DOCTYPE declaration.
Just add the following at the very top of your html (even before the <html> element, on a line of its own, it must be the very FIRST LINE of the document):
<!DOCTYPE html>
This prevents Chrome going into quirks mode emulating odd behaviours of old browsers.
I'm using a CFF font on my page, but it's showing serrated in the browser.
Here you can see how I'm using it: JSfiddle
HTML
<p>Hello everyb#dy!</p>
CSS
body{
font-size: 10px;
}
#font-face {
font-family: Planer_ExtraLight;
src: url('http://www.digitalpersone.com.br/projetos/fonts/planer_extralight.svg#Planer_ExtraLight') format('svg'),
url('http://www.digitalpersone.com.br/projetos/fonts/Planer_ExtraLight.otf'),
url('http://www.digitalpersone.com.br/projetos/fonts/Planer_ExtraLight.eot');
}
p{
font-family: Planer_ExtraLight;
font-size: 4em;
}
Anyone can help me with it?
This should work: http://jsfiddle.net/Allendar/aKGam/1/
p {
font-family: Planer_ExtraLight;
font-size: 4em;
font-smooth: subpixel-antialiased;
-webkit-font-smoothing: subpixel-antialiased;
}
Result
Update
Check the MDN. It seems to not work in most browsers. You might try to look into similar functions of -webkit-font-smoothing in other browsers to add to your styling.
The increase in quality I'm seeing in Safari is humongous tho!
Update 2
I found this might work in Firefox;
browser.display.auto_quality_min_font_size = 0; // default = 20
.. where lower means better quality and slower rendering and vice versa.
Update 3
This is interesting too (https://developer.mozilla.org/en-US/docs/CSS/text-rendering);
text-rendering: geometricPrecision;
I have a span and an input element that share the same CSS definition for font. Why does Chrome use different fonts for them? How would I fix this issue?
My objective is to make them look exactly the same in IE9, Chrome and FF.
CSS definitions (FIXED), if they still matter.
* {
font-family: Verdana,Helvetica,Arial,sans-serif; /* Moving here fixed it */
}
body {
/*font-family: Verdana,Helvetica,Arial,sans-serif; -- This caused the issue*/
font-size: .8em;
margin: 0;
padding: 0;
color: #000;
}
.button
{
text-align:center;
min-width:80px;
display:inline-block;
white-space:nowrap;
background-color:#4A8CF6;
color:#FFF;
padding:4px;
margin:1px;
border:0;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
box-sizing:border-box;
font-size: .8em;
}
Solution
The problem was that the span elements inherited from my CSS definition for body and the input elements didn't. I had defined the font in my CSS with body { font-family:...; } like my computed results show and I thought that using display: inline-block; would force both of them to inherit the font from body but it did not.
The solution was to switch to using * { font-family:...; } for the font definitions. The button and clickable classes simply defined sizes and colors and such.
You have to literally specify input elements if you want them to have the same font like so:
/* Or input[type=submit] depending on your needs */
span, input {
font-family: Arial, sans-serif; /* Your font here */
}
Otherwise the browser uses the default values as your question shows. You're looking under Computed Styles which shows that Chrome has decided the values for you as you haven't specified them.
You should apply CSS reset rules in the beginning of your style sheet. Its purpose is to make all elements have the same look in all browser.
Examples:
http://developer.yahoo.com/yui/reset/
http://meyerweb.com/eric/tools/css/reset/
Related question which can be useful too: https://stackoverflow.com/questions/116754/best-css-reset