+ 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
14 Réponses
+ 8
<link href="source" rel="stylesheet" type="text/css" />
*to make something bold just use the <b> HTML tag*
+ 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! :)
+ 3
Check CSS fundamentals tutorial, it is in "the basic"
+ 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>
+ 2
thanks y'all...
it really helped
+ 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.
+ 2
<link href="source_of_css_file" rel="stylesheet" type="text/css" />
code in css file -
.light{ font-weight: bold; }
+ 2
<link href="css file name (source)" rel="stylesheet" type="text/css" />
+ 2
<link rel="stylesheet" href="your file css.css" type="text/css /> write in html .
+ 1
it is basic css..it will be easy to link HTML
+ 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.
+ 1
<link href="filename.css" rel="stylesheet" type="text/css" />
*use filename with extension
*write code in head tag
+ 1
<link rel="stylesheet" href="source.css" /> for external css and
<head>
<style>
put css here
</style>
</head>
for internal css
+ 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">