0

i have an input field and i want it to be 2 different sizes in internet explorer and firfox if possible, the code i have right now is:

div.search input#query {

  width: 450px;
  height: 24px;
  font-size: 16px;
}

so i want somthing like this:

div.search input#query {

if internet explorer {  width: 450px;}
else {  width: 350px;}
  height: 24px;
  font-size: 16px;
}

thanks

2 Answers 2

4

It's not possible to target a specific directly in a clean way (without CSS hacks) except for Internet Explorer that is aware of conditional comments.

You could put all the IE specific properties into a separate style sheet and embed that after the main stylesheet (so it overwrites the existing settings):

<!--[if IE]>
<link rel="stylesheet" href="ie.css" type="text/css">
<![endif]-->

you will probably want to discriminate between various versions of IE, as IE 6, 7 and 8 tend to behave differently in many respects.

Sign up to request clarification or add additional context in comments.

2 Comments

that would work for me great, how can i embed that after the main stylesheet (so it overwrites the existing settings)? sorry but im new to css and web development.
@Mo just put the above code into the head section of the document after the directive you use to embed your main style sheet (if you are using an external stylesheet?)
0

you can use this script :

http://rafael.adm.br/css_browser_selector/

after you include this script you can easy use in the css.

1 Comment

This is very nice, but the JavaScript requirement is a big downside IMO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.