Currently, placeholder="Your best email"
is not being styled by style:inputText
.
On inspecting element, the user agent stylesheet
is being used for input, textarea, select, button {}
.
Below is my code:
import React from "react";
import {css} from "@emotion/core";
const inputText = css`
::placeholder {
float: left;
height: 35px;
width: 230px;
color: #FFF;
font-family: "Work Sans";
font-size: 30px;
font-weight: 700;
line-height: 35px;
}
`
const inputRound = css`
box-sizing: border-box;
height: 85px;
width: 460px;
border-radius: 100px;
border: 5px solid #FFF;
background-color: transparent;
outline: none;
`
const Subscribe = () => (
<div css={{
display: 'flex'
}}>
<h2>Stay tuned</h2>
<form name="subscribe" method="POST" data-netlify="true">
<p css={inputText}>
<input placeholder="Your best email" type="email" name="email" css={inputRound}/>
</p>
<p >
<button type="submit"><h3>Subscribe</h3></button>
</p>
</form>
</div>
)
export default Subscribe
What is preventing inputText
style from being applied?
Here is a screenshot from dev tools (PS inputText
has been altered to & > ::placeholder
as suggested.
You have to apply the inputText
style directly to the input:
// Change this
- <p css={inputText}>
- <input css={inputRound}/>
- </p>
//to this
+ <p>
+ <input css={[inputText, inputRound]}/>
+ </p>
Or, alternatively, target child input from the inputText
:
const inputText = css`
& > input::placeholder {
...
}
`