HTML / CSS样式标记不起作用

时间:2016-12-25 07:08:17

标签: html css

出于某种原因,我的样式标签都没有在嵌入式CSS或HTML中被选中。字体系列更改既未生效,也未生效border-top: 5px solid black;行。有什么提示吗?

<!DOCTYPE html>
<html>
<head>
    <title>
        My Resume
    </title>
<style type=“text/css”>

#ob {
    border-top: 5px solid black;
}

</style>
</head>

<body>
    <div>
        <h1 style=“font-family: sans-serif”>
            <strong>Corey Schnedl </strong>
        </h1>

        <h4 style=“font-family: Sans-Serif”>
            <strong> XXXXXXXXXXX / XXXXXXXX / XXXXX / XXXXX </strong>
            <br>
            <strong>XXXXXXXXXXXXX</strong>
        </h4>
    </div>

    <div>
        <h3 style=“font-family:Arial”>
            <strong>Objective</strong>
        </h3>
        <p>
            To obtain an entry-level position as a Java software developer.
    </div>

</body> 


</html>

2 个答案:

答案 0 :(得分:4)

使用纯文本引号。这"而非

四次破坏您的代码:

  • <style type=“text/css”>
  • <h1 style=“font-family: sans-serif”>
  • <h4 style=“font-family: Sans-Serif”>
  • <h3 style=“font-family:Arial”>

&#13;
&#13;
<!DOCTYPE html>
    <html>
    <head>
        <title>
            My Resume
        </title>
    <style type="text/css" rel="stylesheet">
    
    #ob {
        border-top: 5px solid black;
    }
    
    </style>
    </head>
    
    <body>
        <div>
            <h1 style="font-family: sans-serif">
                <strong>Corey Schnedl </strong>
            </h1>
    
            <h4 style="font-family: Sans-Serif">
                <strong> XXXXXXXXXXX / XXXXXXXX / XXXXX / XXXXX </strong>
                <br>
                <strong>XXXXXXXXXXXXX</strong>
            </h4>
        </div>
    
        <div>
            <h3 style="font-family:Arial">
                <strong>Objective</strong>
            </h3>
            <p>
                To obtain an entry-level position as a Java software developer.
        </div>
    
    </body> 
    
    
    </html>
&#13;
&#13;
&#13;

答案 1 :(得分:1)

编辑:

style="font-family:'Arial';"

和这个

style

在每个<!DOCTYPE html> <html> <head> <title> My Resume </title> <style type="text/css" rel="stylesheet"> #ob { border-top: 5px solid black; } </style> </head> <body> <div> <h1 style="font-family: sans-serif;"> <strong>Corey Schnedl </strong> </h1> <h4 style="font-family: Sans-Serif;"> <strong> XXXXXXXXXXX / XXXXXXXX / XXXXX / XXXXX </strong> <br> <strong>XXXXXXXXXXXXX</strong> </h4> </div> <div> <h3 style="font-family:Arial;"> <strong>Objective</strong> </h3> <p> To obtain an entry-level position as a Java software developer. </div> </body> </html> 属性

的末尾添加分号

这是您编辑过的页面


    @Component({
      selector: 'my-app',
      template: `<form [formGroup]="form">
          Current value: {{form.controls['myValue'].value}}
          <input type="text" 
             size=40 
             id="myValue"
             name="myValue" 
             required
             [formControl]="form.controls['myValue']">

          <input type="button" (click)="updateValue()" value="Update">
        </form>`
    })
    export class AppComponent {

      form:FormGroup;

      constructor(private fb: FormBuilder) {}

      ngOnInit() {
        this.form = this.fb.group({
          myValue: new Date().toString()
        });
      }

      updateValue(){
        document.querySelector('#myValue').value = new Date().toString();
      }

    }

使用验证器最好检查你的syntex错误。这里https://validator.w3.org/#validate_by_input