Why aren't the CSS rules I am writing being applied?
For some strange reason, I cannot edit or apply styles to html in Sublime Text 2. I cannot do internal styles or link to external styles. However, if I take code that I have done into Dreamweaver or Notepad++, the styles are applied and editable? How can I get sublime Text 2 to allow me apply and edit styles?
I have Windows 7 and I'm new to HTML and CSS. I'm trying to learn different code editors, but it's quite difficult when the editors won't work :(
Thanks!
ETA: When I mean styles I mean css. I can't view any css styling on my html page on Sublime text 2. Only when I use notepad++ or dreamweaver. I can't see css in a browser when I use sublime text 2.
Here's my code:
<!DOCTYPE html>
<head>
<meta charset=utf-8" />
<title>Untitled Document</title>
</head>
<style>
body{
background: orange;
}
</style>
<body>
</body>
</html>
You're issue isn't with the editor; it's likely that there are some errors in the document.
You're currently missing the opening <html>
, <style>
elements should be inside either the <head>
or <body>
rather than between them, and the charset
attribute should have a 2nd quotation to surround the value:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Untitled Document</title>
<style>
body{
background: orange;
}
</style>
</head>
<body>
</body>
</html>
The issue is not the text editor, it must be your code. You may be opening an outdated file and looking for the changes in there. Make sure that you are saving the file in the correct location and opening the correct file when looking for changes.
Also, make sure that you are saving it as .html, Sublime Text 2 will not automatically give your files an extension like Dreamweaver or other editors might.
链接地址: http://www.djcxy.com/p/89414.html上一篇: CSS3透明度+渐变
下一篇: 为什么我写的CSS规则不适用?