position:absolute not working on lit-element
See original GitHub issueMore of a help question, I’m probably doing something wrong here:
@customElement('my-input')
class myInput extends LitElement {
static get styles() {
return css`
:host {
display:contents;
}
input {
all:inherit;
display:inline;
}
.link {
position:absolute;
right:0px;
top:50%;
}
`
}
render() {
return html`
<input></input>
<span class=link>content</span>
`
}
}
I would expect content to be placed inside the input on the right side, instead it is placed relative to the parent element. If I place the <span>
inside the <input>
element the same happens. This is not the behavior I would expect, what is going on here?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
position:absolute not working on lit-element #1173 - GitHub
position : absolute elements are positioned wrt their offset parent, which is the closest position: relative ancestor. You'll need position: ...
Read more >LitElement: drag and drop absolute positioned items inside a ...
The items are positioned absolute , the outer container is positioned relative . Code looks like this: static get styles(): CSSResult { return ......
Read more >Why is position not working?. Guide to CSS positions - Medium
The absolute position exiles the element from natural flow. All you are left now with are tricks. For instance, centring horizontally. margin: ...
Read more >Built-in directives - Lit.dev
Directive, Summary. Styling. classMap. Assigns a list of classes to an element based on an object. styleMap. Sets a list of style properties...
Read more >Lit Element With Gql And Ts (forked) - StackBlitz
Lit-element demo base project with typescript. ... @customElement("not-link"). export class NotLink extends LitElement { ... position: absolute;. bottom: 0;.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Attributes values don’t have to be quoted in HTML unless they contain a whitespace,
>
,<
,=
, or a quote.Closing based on the discussion above. These are limitations of css in general and there’s nothing to address in the Lit library.