Solved

Need to put css style code within html doc

Posted on 2008-10-22
8
301 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Understanding mobile browsers 9 62
How to get this page layout correct 13 29
Browser Chrome downloads colored link 5 40
CSS: Making responsive table look nicer 7 24
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

776 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