Linking CSS File to HTML


To insert a style sheet into an HTML file, we use a link object. is empty and goes inside the header.

< head >
< link >
< /head >

the type of file to be inserted, the opening link tag requires a set of attributes used using rel = "style file".

< head >
< link rel = "style" >
< /head >

style sheet area, set the href attribute to "style.css".

< head >
< link rel = " stylesheet " href = "style.css" >
< /head >Ad Link



OR



< ! -- Linking HTML and CSS -- >

< ! -- rel attributes specifies the relationship between the HTML document and an external resource -- >

< ! -- href defines the destination of the link -- >

< ! -- style/style.css [Folder/File Name] -- >


< link rel = " stylesheet " type = " text/css " href = " style/style.css " >

Example:



< !DOCTYPE html >

< html lang = " en-US " >

< head >

< meta charset = " utf-8 " >

< meta name = " viewport " content = " width = device-width, initial-scale = 1 ">

< title > Software Adroit < /title >

< link rel = " stylesheet " type = " text/css " href = " style/style.css " >

< /head >

< body >

< p >A programming learning website.< /p >

< /body >

< /html>