New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Linking CSS and JavaScript files to your HTML file

From: Create an Interactive Animated Timeline with jQuery

Video: Linking CSS and JavaScript files to your HTML file

Next, we need to hook these CSS and JavaScript files up into our index.html file. So, let's take the index.html file and open it up in your chosen text editor. After that title tag, let's hit Return. And let's start by typing beginning tag, type link, rel for relationship equals style sheet, type equals text/css. Another attribute href equals includes/timeline.css. Next, let's create a script tag. Type equals text/javascript.

Linking CSS and JavaScript files to your HTML file

Next, we need to hook these CSS and JavaScript files up into our index.html file. So, let's take the index.html file and open it up in your chosen text editor. After that title tag, let's hit Return. And let's start by typing beginning tag, type link, rel for relationship equals style sheet, type equals text/css. Another attribute href equals includes/timeline.css. Next, let's create a script tag. Type equals text/javascript.

Source attribute equals includes/jquery-1.8.3.min.js. Then end the script tag. Next, let's link in our custom JavaScript file. So, script type equals text/javascript. Source equals includes/timeline.js, and then end that script tag. Now, with those in place, we're going to add a comment, so, we can put some conditional scripts in place for IE 7 and 8. So, we'll start with a standard HTML comment, and inside here, we'll put the IE conditional statement. If less than IE 9 inside of brackets.

And then before the closing comment, another set of square brackets and type endif. Now, with that in place, let's get our cursor inside of this conditional statement. And first, we're going to make a link to our IE 7 and 8 CSS file. So, link relationship equals stylesheet, type equals text/css, and then href equals includes/timeline_ie_7_8.css. On the next line, we're going to put a link into Google's HTML5 shiv.

This way, IE7 and 8 will understand HTML5. So, that's going to be script, source equals Http://html5shiv.googlecode.com/svn/trunk/html5.js, and then end the script tag. So, now with all of these hooks into our CSS and JavaScript files, we're ready to start creating our HTML containers.

Show transcript

This video is part of

Image for Create an Interactive Animated Timeline with jQuery
 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold

Are you sure you want to delete this note?

No

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.