HTML和CSS不起作用? [英] HTML and CSS is not working?
问题描述
我在网络编程方面真的很新颖,特别是当涉及到HTML和CSS时,我正在阅读O reily的Head第一本书,当我运行它到我的web浏览器时,这个例子不起作用,我正在使用谷歌浏览器,并且我正在使用记事本++来编写我的代码,任何人都可以帮我解决这个问题吗?因为我的CSS代码似乎不工作
I am really new when it comes to web programming, specially when it comes to HTML and CSS, I was reading the Head first book by O reily and there was this example that is not working when I run it to my web browser, I am using Google chrome and I was using a notepad++ for this code of mine, can anyone help me out here? since my CSS code doesn't seem to work
<html>
<head>
<title> Starbuzz Coffee</title>
<style type="text/css">
body {
background-color: #d2b48c;
margin-left: 20%;
margin-right: 20%;
border: 1px dotted gray;
padding: 10px 10px 10px 10px;
font-family: sans-serif;
}
</style>
</head>
<body>
<h1>StarBuzz Coffee Beverages!</h1>
<h2>House Blend , $1.49</h2>
<p>A smooth, mild blend of coffee from mexico,Oblivia and Guatemala</p>
<h2>Mocha Coffee Latter , $2.96</h2>
<p>EsPresso, Steamed milk and Chocolate chip</p>
<h2>Capuccino , $1.07</h2>
<p>A mixture of Espresso, steamed milk and foam</p>
<h2>Chai Tea , $2.59</h2>
<p> A spicy drink with black tea, spices, milk and honey</p>
</body>
</html>
推荐答案
我将代码直接粘贴到jsfiddle中,不适用于文档。尝试将引号( style type =text / css
)更改为常规引号( style type =text / css
I pasted your code directly into jsfiddle and the CSS was not applied to the document. Try changing the curly quotes (style type="text/css"
) to regular quotes (style type="text/css"
) and try again.
工作示例: http: //jsfiddle.net/dPdHu/
这篇关于HTML和CSS不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!