0
Can i put css codes inside the <body> tag
pliss tell.. or do i have to write it down on a seperate file and then link them together
8 ответов
+ 8
<style>css</style>
+ 6
Yes.
+ 3
style and link tags belong in the document head.
<!DOCTYPE html>
<html>
<head>
<!-- css or link (included css) here-->
</head>
<body>.....
You can use style attributes on most elements, however it is best practice to just use CSS/Javascript for this tying into custom attributes or class/id attributes.
+ 2
thank you bro... you mean i can put my css code inside the style tags.. right
+ 2
To add on to Zainab answer, you can import your external CSS file to link to your html using the following syntax:
<head>
<link rel="stylesheet" type="text/css" href="pathToYourCssFile.css"/>
</head>
The 2 other styling via inline and embed is as explained.
+ 1
besides can i put the style tags inside the body tags
+ 1
You can put as many <style></style> you want, and anywhere inside <html></html> ( with common restrictions for valid Xml ^^ )...
0
Hi,
There's 3 ways of styling HTML:
1. Inline CSS
2. Embed in the HTML file
3. External CSS..
1. Inline css looks like this:
<p style="color:red;"> Red paragraph</p>
2. Embed CSS:
<style>
p{
color: red;
}
</style>
3. External, (in a separate file linked to HTML)
p{
color: red;
}