简体   繁体   English

HTML <p> 样式代码不起作用

[英]html <p> style code not working

Trying to code a simple webpage and am learning html. 试图编写一个简单的网页,我正在学习HTML。 I wonder why my simple styling code for the 我想知道为什么我的简单样式代码

makes no changes. 没有变化。 Here it is below. 它在下面。

<!DOCTYPE html>
<html>
<head>
<!-- SE copied from old site   -->

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/
font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/topnav-index.css">
<!-- abv css I created myself, just the TopNav bar -->

<style>
<!-- this is for page wide style  -->
<!-- define all paragraph font for main pg   -->
p {
color: red;
text-align: left;
font-family: palatino;
font-size: 16pt;
background-color: #909090;
<!-- margin: 4 prop is top, R, bott, L -->
margin-left: 32px;
margin-top: 30px;
<!-- margin: 20,25,35,40;  -->
padding-left: 12%;
padding-top: 10%;
    } 

</style>
</head>

<body>

<div class="topnav" id="myTopnav">
  <a href="#home" class="active">Home</a>
  <a href="#news">News</a>
  <a href="#contact">Contact</a>
  <a href="#about">About</a>
  <a href="javascript:void(0);" class="icon" onclick="myFunction()">
    <i class="fa fa-bars"></i>
  </a>
</div>

<div style="padding-left:16px">
  <h2>Title</h2>
  <p>Responsive Topnav Example</p>
 </div>

<!--  main content -->
<p>B This site explores the connection between XXX and the
 historical events...</p>

Now the Top Nav bar works but none of the formatting for the p text seems to do anything. 现在Top Nav栏可以工作,但是p文本的格式似乎都没有做任何事情。 It's in the header & I understand the p, in the greater/less than signs, acts as a specialty container of it's own... 它在标题中并且我理解p,在大于/小于标志中,作为它自己的特殊容器......

in css you should use /* */ for comment and not <!--- --> 在css中你应该用/ * * /来评论而不是<!--- -->

p {
    color: red;
    text-align: left;
    font-family: palatino;
    font-size: 16pt;
    background-color: #909090;
    /* margin: 4 prop is top, R, bott, L */
    margin-left: 32px;
    margin-top: 30px;
    /*margin: 20,25,35,40;  */
    padding-left: 12%;
    padding-top: 10%;
} 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM