Solved

Need to put css style code within html doc

Posted on 2008-10-22
8
304 Views
Last Modified: 2013-12-08
Hi there -- I need to put the following css within my html code instead of linking like i have it here below which works just fine but I need to hold all the css within my html doc.  I currently have a bunch of styles already within my html but having trouble incorporationg  these two files within my html doc instaed of them linking.  Not sure on the syntax.

<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="public/css/ie6.css" /><![endif]-->
<!--[if gt IE 6]><link rel="stylesheet" type="text/css" href="public/css/ie7.css" /><![endif]-->

One would think this would work: (example) what am i doing wrong?
<!--[if gt IE 6]>.right-col {margin-top: 95px;}<![endif]-->
0
Comment
Question by:WebGirlCrissy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 21

Expert Comment

by:silemone
ID: 22778907
no offense, but to save yourself some trouble it this is time sensitive, why not just use a javascript to find which browser and then dynamically link the appropriate css file
0
 
LVL 19

Expert Comment

by:LordOfPorts
ID: 22778917
You would need the style tag within the statement too:
<!--[if gt IE 6]>
     <style type="text/css">
        .right-col {margin-top: 95px;}
     </style>   
<![endif]-->

Open in new window

0
 
LVL 21

Expert Comment

by:silemone
ID: 22778943
he's using <link LordOfPorts...style not needed in this case...
0
RoboForm Secure Password Management System

RoboForm Everywhere - Superb Browser Support
Windows / Apple / IOS / Android / Linux / Chrome OS
Use different complex passwords everywhere
Best Secure Password Management by far
Synchronize all of your devices instantly
Safe, Secure & Highly Recommended!

 
LVL 21

Expert Comment

by:silemone
ID: 22778957
0
 

Author Comment

by:WebGirlCrissy
ID: 22779225
ok, i'll try that thank you both - how would i combine the two in JS below. (else if) not sure on correct syntax.
<script type="text/javascript">
<!--[if gt IE 6]>
     <style type="text/css">
        .right-col {margin-top: 95px;}
     </style>  
<![endif]-->
</script>

<script type="text/javascript">
<!--[if gt IE 7]>
     <style type="text/css">
        .right-col {margin-top: 75px;}
     </style>  
<![endif]-->
</script>
0
 
LVL 19

Accepted Solution

by:
LordOfPorts earned 350 total points
ID: 22779244
silemon, author's requirement:

<< "I need to put the following css within my html code instead of linking like i have it here "
WebGirlCrissy, you do not need the script tags:

<!--[if gt IE 6]>
     <style type="text/css">
        .right-col {margin-top: 95px;}
     </style>   
<![endif]-->
 
<!--[if gt IE 7]>
     <style type="text/css">
        .right-col {margin-top: 75px;}
     </style>   
<![endif]-->

Open in new window

0
 
LVL 21

Assisted Solution

by:silemone
silemone earned 150 total points
ID: 22779283
oh...oops missed that
0
 

Author Closing Comment

by:WebGirlCrissy
ID: 31508853
Thank you both -- LordofPorts that worked without the script tags.
:))
0

Featured Post

RoboForm Secure Password Management System

RoboForm Everywhere - Superb Browser Support
Windows / Apple / IOS / Android / Linux / Chrome OS
Use different complex passwords everywhere
Best Secure Password Management by far
Synchronize all of your devices instantly
Safe, Secure & Highly Recommended!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question