Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Need to put css style code within html doc

Posted on 2008-10-22
8
Medium Priority
?
307 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
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 1400 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 600 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

886 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