Solved

Need to put css style code within html doc

Posted on 2008-10-22
8
303 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
parent control advice for app searches 4 32
CSS Style 8 42
bootstrap wrap text 1 30
CSS Flex space-between 2 20
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

685 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