Solved

Need to put css style code within html doc

Posted on 2008-10-22
8
300 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
  • 4
  • 2
  • 2
8 Comments
 
LVL 21

Expert Comment

by:silemone
Comment Utility
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
Comment Utility
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
Comment Utility
he's using <link LordOfPorts...style not needed in this case...
0
 
LVL 21

Expert Comment

by:silemone
Comment Utility
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:WebGirlCrissy
Comment Utility
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
Comment Utility
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
Comment Utility
oh...oops missed that
0
 

Author Closing Comment

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

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now