How to use VSCode to set the background and font background settings for HTML projects: Create a new HTML file and add a background color definition in the CSS style sheet, such as body {background-color: #f0f0f0;}. Font settings: Load a web font, import it into an HTML page, and specify the font using the font-family property in a CSS style sheet, for example body {font-family: 'Roboto', sans-serif;}.
How to use VSCode to set the background and font for an HTML project
Background settings
<link>
tag in the <head>
tag to link to an external CSS style sheet . For example: <head> <link rel="stylesheet" href="style.css"> </head>
body { background-color: #f0f0f0; }
Font Settings
<link>
tag inside the <head>
tag: <head> <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet"> </head>
font-family
property to specify your font. For example: body { font-family: 'Roboto', sans-serif; }
font-size
, font-weight
and font-style
. Sample HTML and CSS code
Here is a sample HTML and CSS code to set the background and font:
<head> <link rel="stylesheet" href="style.css"> </head>标题
正文
body { background-color: #f0f0f0; font-family: 'Roboto', sans-serif; font-size: 16px; font-weight: 400; } h1 { font-weight: 700; }
The above is the detailed content of How to set the background and font when creating an HTML project with vscode. For more information, please follow other related articles on the PHP Chinese website!