示例
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vue Basics</title>
<link
href="https://fonts.googleapis.com/css2?family=Jost:wght@400;700&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="styles.css" />
<script src="https://unpkg.com/vue@3/dist/vue.global.js" defer></script>
<script src="app.js" defer></script>
</head>
<body>
<header>
<h1>Vue Styling</h1>
</header>
<section id="styling">
<input type="text">
<p>Style Me!</p>
<button>Toggle Paragraph</button>
<input type="text">
<p>Style Me Inline!</p>
</section>
</body>
</html>
app.js
const app = Vue.createApp({
data(){
return {
};
},
computed: {
},
methods:{
}
});
app.mount('#styling');
styles.css
* {
box-sizing: border-box;
}
html {
font-family: 'Jost', sans-serif;
}
body {
margin: 0;
}
header {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26);
margin: 3rem;
border-radius: 10px;
padding: 1rem;
background-color: #4fc08d;
color: white;
text-align: center;
}
#styling {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26);
margin: 3rem;
border-radius: 10px;
padding: 1rem;
text-align: center;
}
#styling p {
font-size: 1.25rem;
font-weight: bold;
border: 1px solid #4fc08d;
background-color: #4fc08d;
color: white;
padding: 0.5rem;
border-radius: 25px;
}
#styling button {
font: inherit;
cursor: pointer;
border: 1px solid #ff0077;
background-color: #ff0077;
color: white;
padding: 0.05rem 1rem;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.26);
border-radius: 20px;
margin: 0 1rem;
}
.user1 {
background-color: blue;
color: white;
}
.user2 {
background-color: purple;
color: white;
}
.hidden {
display: none;
}
.visible {
display: block;
}
.demo {
width: calc(100% - 32px);
height: 100px;
margin: 16px;
border: 2px dashed #ccc;
}
.active {
border-color: red;
background-color: salmon;
}
标签:box,color,margin,Practice,Dynamic,Styling,background,white,border
From: https://blog.csdn.net/KevinHuang2088/article/details/141437213