+ 6

How do I link a CSS file to my HTML file?

ie. if i have a text and i want to make it bold using the <p class= "light">text</p>.... am a baby programmer, your answers will really help

27th Dec 2016, 5:34 PM
ITAGZ
ITAGZ - avatar
14 Réponses
+ 8
<link href="source" rel="stylesheet" type="text/css" /> *to make something bold just use the <b> HTML tag*
27th Dec 2016, 5:40 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 6
To use CSS within HTML you can use the '<script> </script>' tags or you can use: <link rel="stylesheet" href="(put the location of your CSS here)"> To link to an external stylesheet. I would normally use an external stylesheet as I think it's easier. Hope this helped! :)
27th Dec 2016, 5:39 PM
Thomas John
Thomas John - avatar
+ 3
Check CSS fundamentals tutorial, it is in "the basic"
27th Dec 2016, 5:39 PM
Mateusz Kifner
Mateusz Kifner - avatar
+ 3
All you need is to put a link tag in the HEAD section of your HTML file that will link to the CSS file's location. Here's an example: <!DOCTYPE html> <html> <head> <title>Example</title> <link href="C:\Example\inAction.css" rel="stylesheet" type="text/css" /> </head> <body> </body> </html>
5th Jan 2017, 5:33 PM
Ghauth Christians
Ghauth Christians - avatar
+ 2
thanks y'all... it really helped
27th Dec 2016, 8:53 PM
ITAGZ
ITAGZ - avatar
+ 2
if you only need a few items bold through out the site, just wrap the text in <b>text here<\b> tags. it is a more effecient option.
5th Jan 2017, 6:19 AM
Chris James
Chris James - avatar
+ 2
<link href="source_of_css_file" rel="stylesheet" type="text/css" /> code in css file - .light{ font-weight: bold; }
5th Jan 2017, 6:44 AM
Akshay Kapoor
Akshay Kapoor - avatar
+ 2
<link href="css file name (source)" rel="stylesheet" type="text/css" />
5th Jan 2017, 8:39 AM
furkan ali
furkan ali - avatar
+ 2
<link rel="stylesheet" href="your file css.css" type="text/css /> write in html .
5th Jan 2017, 9:22 AM
Fardony Rozi Saputra
Fardony Rozi Saputra - avatar
+ 1
it is basic css..it will be easy to link HTML
5th Jan 2017, 3:02 AM
Bhargavi
+ 1
You will have to put the following code inbetween the <head> and </head> in the HTML page where you want the stylesheet to apply. <link rel="stylesheet" href="pathtocss.css" /> The type="text/css" attribute is not needed anymore.
5th Jan 2017, 4:29 PM
John van den Elzen
John van den Elzen - avatar
+ 1
<link href="filename.css" rel="stylesheet" type="text/css" /> *use filename with extension *write code in head tag
5th Jan 2017, 6:42 PM
Miten Patel
Miten Patel - avatar
+ 1
<link rel="stylesheet" href="source.css" /> for external css and <head> <style> put css here </style> </head> for internal css
5th Jan 2017, 11:43 PM
Code Freak
Code Freak - avatar
+ 1
Everyone has given a good answer, I'm going to add onto their answers. It's key to remember where you are working from, when you start to get into more advanced projects you'll have folders organizing your JavaScript, CSS, SCSS (preprocessor for CSS), Resources (Images, Fonts, etc) Example Folder structure: CSS/ style.css IMG/ bg1.jpg logo.svg logo2.png JS/ function.js index.html If I want to link an external style sheet to index you would have to tell the browser where this style sheet is relative to where you're currently working. If you're in index.html then it'd be as simple as <link rel="stylesheet" href="CSS/style.css">
12th Jan 2017, 12:47 AM
Poohbie
Poohbie - avatar