To created component with built-in styles with a few lines of code, you can use the vue-styled-components to create them.
To created component with built-in styles with a few lines of code, you can use the vue-styled-components to create them.
First, install the package by running:
npm i vue-styled-components
Then you can create some basic components, for example:
import styled from "vue-styled-components";
export const StyledTitle = styled.h1`
font-size: 1.5em;
text-align: center;
color: palevioletred;
`;
export const StyledHeader = styled.header`
padding: 4em;
background: yellow;
`;
You just need to import the package then use the template tags that came with the code to create new styled elements.
You can change the font size, text alignment, and other things with the tags.
The h1
tag makes an h1 element.
header
makes a styled header element.
Then you can use it by registering the component and use it:
<template>
<div id="app">
<styled-header>
<b>header</b>
</styled-header>
<styled-title>hello</styled-title>
</div>
</template>
<script>
import { StyledTitle, StyledHeader } from "./components";
export default {
name: "App",
components: {
"styled-title": StyledTitle,
"styled-header": StyledHeader
}
};
</script>
You just register them in components
and reference it in our templates.
The styles in the string are applied automatically.
software-development vue vuejs styled-components front-end-development
Hire Front-end web developers and programmers in India from ValueCoders for your custom offshore Front-end application development projects. Hire Front-end developer from ValueCoders and get interactive Front-end web designs. 16+ years exp. , 100% money back guarantee, 450+ Staff . Contact Us Today!
Employ our best Vue.js Developers for your custom Vue JS app development. We provide end to end Vue development services & solutions to both small and large companies.
To make the most out of the benefits of offshore software development, you should understand the crucial factors that affect offshore development.
Want to Hire VueJS Developer to develop an amazing app? **[Hire Dedicated VueJS Developers](https://hourlydeveloper.io/hire-dedicated-vue-js-developer/ "Hire Dedicated VueJS Developers")** on the contract (time/project) basis providing regular...
Check out these five criteria for the selection of your software vendor, and you will never regret having the wrong quality product made for you.