Is there a way to shorten these lines of code and not repeat myself, since they do the same thing?
.my-form input[type="text"]{
padding: 8px;
width: 100%;
}
.my-form input[type="email"]{
padding: 8px;
width: 100%;
}
Is there a way to shorten these lines of code and not repeat myself, since they do the same thing?
.my-form input[type="text"]{
padding: 8px;
width: 100%;
}
.my-form input[type="email"]{
padding: 8px;
width: 100%;
}
If the only input fields are text and email then you can simply set your code in .my-form input {//code here}.
The best way to go about this would be to use a CSS Preprocessor such as SASS. It would help in achieving such re-usability in code.
Besides removing the "[type=...]" as Abdul Hannan suggested, the only shorter way I can think of to express this would be the following:
.my-form input[type="text"],
.my-form input[type="email"]{
padding: 8px;
width: 100%;
}