Next.js Discord

Discord Forum

Regarding multiple descriptions of style attribute

Answered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
I would like to rewrite the style attribute of the code below for Next.js, but I'm having trouble figuring out how to do it.
I would appreciate it if you could help me
<div className={`${styles['carousel-caption']} ${styles['d-flex']}`} style="position: absolute;top: 0px;left: 50%;width: 50%;height: 100%;"></div>
Answered by joulev
<div
  className={`${styles['carousel-caption']} ${styles['d-flex']}`}
  style={{
    position: "absolute",
    top: 0.
    left: "50%",
    width: "50%",
    height: "100%",
  }}
>
  Hello world
</div>
View full answer

9 Replies

@Atlantic horse mackerel is there any specific reason why u're using tailwind classnames and native css styling?
Transvaal lionOP
I write the style attribute because I want it to apply only to this tag.
Atlantic horse mackerel
so why not use tailwind to apply the styling to the specific tag?
Transvaal lionOP
I will try.
Atlantic horse mackerel
have you ever worked with react/tailwind before?
Transvaal lionOP
I've only used it for a little while, and I'm currently learning.
Answer