I have a button which I want at a certain poistion on the screen. Problem is in firefox its a little up and in IE its a little down. What can I do?
.btn1{
clear: both;
margin-top: 4%;
margin-bottom: 0px;
margin-right: 0px;
margin-left: 740px;
}
The reason you are seeing differences between browsers is because you are using %. % is calculated and rounded differently between different browsers. Try using px or pt
Do a normal stylesheet that makes it work on just Firefox. Then, do this:
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="your-stylesheet-here.css" />
<![endif]-->
Make this stylesheet a specific one for IE, so that the box looks correct on IE.
Put this at the top of the page:
<!DOCTYPE html>
Have you in your HTML code this?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Use specified stylesheets:
<!--[if IE]>
<link rel="stylesheet" href="ie.css" />
<![endif]-->
Do you know that you can use: margin: 4% 0px 0px 760px;?
If you want to make something horizontally-center use: margin: 0px auto;. Cause 760px may crash in lower/higher resolutions.
You need to use a "CSS reset"... Google for it :-)
Every Browser has his own default CSS, thats the problem ;-)
Related
I have this class in CSS and i need to change it when its IE. I want to remove padding-bottom. How can I do that?
I don't want to add another CSS file, I want to change only one property in one class.
.container-wrapp{
float: left;
position: relative;
width: 100%;
padding-bottom:100px;
height: 100%;
}
I tried this but without success:
<!--[if IE]>
<style type="text/css">
.container-wrapp{
float: left;
position: relative;
width: 100%;
height: 100%;
}
</style>
<![endif]-->
For IE10+ you can do the following:
#media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
.container-wrapp{padding-bottom:0;}
}
Demo Fiddle (Note that the text is red only in IE 10+)
#media all and (-ms-high-contrast: none),
(-ms-high-contrast: active) {
.red {
color: red
}
}
<div class="red">text</div>
NB: Using hacks like these are generally frowned upon. Use with caution.
Create a stylesheet file ie.css and use if AFTER the global style definition this way:
<!--[if IE]>
<link rel='stylesheet' type='text/css' href='ie.css'/>
<![endif]-->
This should work.
I think for best practice you should write IE conditional statement inside the tag that inside has a link to your special ie specific style sheet. This HAS TO BE after your custom css link so it overrides the css property. Here is an example:
<link rel="stylesheet" type="text/css" href="style.css" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="all-ie-only.css" />
<![endif]-->
Hope this will helps you!
IE 10 and onward no longer support conditional comments. From the MS official website:
Support for conditional comments has been removed in Internet Explorer
10 standards and quirks modes for improved interoperability and
compliance with HTML5.
Please see here for more details.
If you desperately need to target ie, you can use this jQuery code to add a ie class to and then use .ie class in your css to target ie browsers.
if ($.browser.msie) {
$("html").addClass("ie");
}
Checkout this link How to create an ie only stylesheet , You need to create a separate style sheet for IE.
I'm working with responsive website. I've used media queries for making that responsible. Basically, I haven't used any fixed width. I've used percentage as a width of every div.
So that the website can be scaled proportionally according to resizing of browser. For using percentage of wide may be caused problem for older ie. As ie prior to ie 9 don't support media query, so, I want to build the non-scalable version for those ie. As I gave only few code for bringing scalability, so is it okay if I write the CSS code at my main stylesheet under/at anywhere with my default CSS?
Like at style.css:
#info {
width: 13.672%;
/*if ie9 and lower
width: 175px;*/
height: 830px;
/*if ie9 and lower
margin-right: 40px;*/
margin-right: 3.125%;
float: left;
}
img {
margin: 0px;
padding: 0px;
border: 0px;
max-width: 100%;
/*if ie9 and lower
max-width: inherit*/
height: auto;
/*if ie9 and lower
height: inherit*/
}
I want to write that format. But, I don't know the correct format. Please, tell me the correct format.
Another question to you. As those version of ie don't support the media-query, so the meta tag
<meta name="viewport" content="width=device-width, maximum-scale=1.0, minimum-scale=1.0, initial-scale=1.0" />
<link href="KT2012.css" rel="stylesheet" type="text/css" />
<link href="kt_large.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" media="only screen and (min-width:50px) and (max-width:500px)" href="kt_small.css" />
<link rel="stylesheet" type="text/css" media="only screen and (min-width:501px) and (max-width:800px)" href="kt_tablet.css" />
<link rel="stylesheet" type="text/css" media="only screen and (min-width:801px) and (max-width:1024px)" href="kt_medium.css" />
with tablet.css, mobile.css don't create any problems for those older version ie, isn't it? I mean I want to write IE special css only at my main stylesheet (KT2012.css). Should I write every IE special css at every stylesheet like at mobile.css, tablet.css etc? If that devised based css file don't support at older ie, so, I don't do any things with that device/viewport based stylesheet if I make non-scalable version for ie, isn't it?
I'd recommend the approach taken by the HTML5 boilerplate, outlined here by Paul Irish. Basically, set up your document like this:
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
You now have classes in place to accurately target only certain versions of IE. Your css will look like this:
.element { margin-bottom: 20px; }
.lt-ie9 .element { margin-bottom: 10px; }
You then avoid CSS hacks, and can keep everything in a single stylesheet.
One way to do this is with Conditional Comments.
IE <= 9 (is the only browser vendor that) supports them, which you can use to specifically target any version(s) of IE. For example
<!--[if IE 9]>
Special instructions for IE 9 here, for example load a specific CSS file to override rules only for IE 9
<![endif]-->
IE 10 has dropped support for them though.
More recently the HTML5 boilerplate introduced a class based approach to avoid the multiple stylesheets (i.e. HTTP calls) issue and fragmented CSS rules that conditional comments tends to create.
I'm having some trouble with a font I found on Google Web Fonts.
As you can see in the image posted below, the capital V in 'Versus' overlaps with the 'e' when i'm using Firefox. Though when i'm using Chrome (or IE) it does not overlap and leaves me with an ugly space between the two characters.
Is there any way to fix this and make it look like the one in Firefox? Or should I start looking for another font?
My HTML:
<html>
<head>
<meta charset="utf-8">
<title>Versus</title>
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link href='http://fonts.googleapis.com/css?family=Marck+Script' rel='stylesheet' type='text/css'>
</head>
<body>
<div>
<h1>Versus</h1>
</div>
</body>
My CSS:
h1 {
font-family: 'Marck Script', cursive;
font-size: 100px;
color:#444;
text-align:center;
padding:0 50px;
text-shadow: 2px 2px 3px #777;
}
Thanks in advance!
In order to fix the spacing in a font you should use:
letter-spacing: 10px /* How ever much you need */
Without knowing the specifics on the HTML and the CSS you already have in place, you can fix the problem area by using something like this:
style
span { letter-spacing: -4px }
html
<span>V</span>ersus
It's hokie, but it should work.
Firefox nowadays supports kerning when using a font with kerning pairs. Other browsers haven’t caught up. There are several proposed CSS features that would affect kerning, and Firefox has some support to them, but the other browsers don’t.
So you should look for another font. Manually tuning spacing by letter-spacing or margin properties is troublesome and risky; you easily end up with breaking things on Firefox.
If you keep using the Marck Script font, it is better to download it and install it on your server and use it from there. There are problems with many Google fonts when used on the Google server. In this case, IE 9 in Standards Mode does not use the font; the error code CSS3117 appears in the console, so there is apparently something wrong in Google settings.
For some reason, I can't get rgba working within my CSS using IE9. I've tested it using Chrome, and it works fine. Not sure what's wrong.
My HTML is:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><?php bloginfo('name'); ?> - <?php bloginfo('description'); ?></title>
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Raleway:100&v1" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
</head>
<body>
<?php wp_nav_menu(); ?>
</body>
</html>
My CSS is:
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
body {
font-size: 62.5%;
}
.menu {
font-size: 5em;
font-family: 'Raleway', arial, serif;
}
.menu ul li a {
background: rgba(0,0,0,0.5);
text-decoration: none;
}
The new standards support in Internet Explorer 9 requires the browser to be in Internet Explorer 9 Standards mode (“IE9 mode”). The best way to do this is to use a standards !DOCTYPE directive and no X-UA-Compatible meta tag or HTTP header. The !DOCTYPE to invoke IE9 mode is the following:
<!DOCTYPE html>
background-color: rgba(0,0,0,0.5);
Well, I found out why. Seems as though "Compatibility View" was enabled so I disabled it and, voila. I probably clicked it by accident when I wanted to click on the refresh button.
I was having issues with background-color in ie9 as well. After scouring through solutions with my google-fu, I realized I was using this border-radius.htc which was breaking all the CSS in that particular div. Not just the background-color, but the borders and font colors as well. It was being used like this:
<style>
.ie-rounded-corner{behavior: url(../include/stylesheets/border-radius.htc); }
</style>
<div class="ie-rounded-corner">Hello World</div>
I was using that border-radius hack for ie6/7/8 to add rounded corners on some elements. This breaks the page in IE9. Upon removing that class, everything worked as expected in IE9. My rounded corners are now gone in ie6/7/8. Perhaps a different solution is now needed for legacy IE browsers.
In a CSS file, is there a way to give a specific height for a DIV that only applies to Internet Explorer ONLY, and at the same time, give that same DIV another height that applies to all browsers except for Internet Explorer?
You can create an IE-specific stylesheet and use IE Conditional statements.
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="iespecific.css" />
<![endif]-->
This way, you basically have two stylesheets; one for IE and other for rest of the standard-compliant browsers.
Hacks could have been used such as:
_height:500px;
*height:500px;
But that is not recommended.
See Also:
How To Create an IE-Only Stylesheet
I have used the following and it worked in IE8. Put the following code within tag.
You can watch the online version from here, http://nazmulweb.com/site5/demo/iecss/
<style type="text/css">
#tgtDiv
{
height: 300px;
width: 400px;
border: 1px solid green;
}
</style>
<!--[if IE]>
<style type="text/css">
#tgtDiv
{
height: 300px;
width: 400px;
border: 5px solid red;
}
</style>
<![endif]-->
try this
<style>
#mydiv { height:800px; }
</style>
<!--[if IE]>
<style>
#mydiv { height:500px; }
</style>
<![endif]-->
Create 2 css files, one for IE and one for the other browsers
Load the css file according to the browser like described here