Coder Social home page Coder Social logo

Header is not styling itself about header HOT 12 CLOSED

editor-js avatar editor-js commented on July 19, 2024
Header is not styling itself

from header.

Comments (12)

PradhaID avatar PradhaID commented on July 19, 2024 27

i need to add several styles on my css when using tailwindcss like :

h1.ce-header{
  @apply text-3xl font-bold
}
h2.ce-header{
  @apply text-2xl font-semibold
}
h3.ce-header{
  @apply text-xl font-semibold
}
h4.ce-header{
  @apply text-lg font-semibold
}
h5.ce-header{
  @apply text-base font-semibold
}
h6.ce-header{
  @apply text-base font-semibold
}

from header.

trancethehuman avatar trancethehuman commented on July 19, 2024 5

Issue still exists with Tailwind 3.3.2 and editorjs 2.28

from header.

roncarino avatar roncarino commented on July 19, 2024 2

I'm having the same problem but I'm not using any css framework, just pure css

Umm that sounds quite odd honestly. Anyway, in my case, I have solved extending Header class and overwriting render function to add and extra wrapper around "h" element. Not sure if this can help you.

class MyHeader extends Header {
    /**
     * Return Tool's view
     * @returns {HTMLHeadingElement}
     * @public
     */
    render() {
        const extrawrapper = document.createElement('div');
        extrawrapper.classList.add('content');
        extrawrapper.appendChild(this._element);

        return extrawrapper;
    }
}

from header.

saqibtanveer786 avatar saqibtanveer786 commented on July 19, 2024 2

Those who are using tailwind can solve this by adding the following code to their global.css:
@layer base {
h1 {
@apply text-2xl;
}
h2 {
@apply text-xl;
}
/* ... */
}

I found this from the below two links:
https://tailwindcss.com/docs/preflight#headings-are-unstyled
https://tailwindcss.com/docs/adding-custom-styles#adding-base-styles

from header.

MejanH avatar MejanH commented on July 19, 2024 1

in my case, tailwindcss removed the default browser heading styles. source: https://laracasts.com/discuss/channels/javascript/editorjs-inline-styles-overruled-by-tailwindcss

from header.

roncarino avatar roncarino commented on July 19, 2024

I think I found the reason. I am using Bulma to build my project and somehow its css override your "ce-header" css. Not entirely sure how to make this work now but at least I know the problem. I think I can close the issue. Thanks

Schermata 2019-05-13 alle 09 11 42

from header.

AjeaSmith avatar AjeaSmith commented on July 19, 2024

I'm having the same problem but I'm not using any css framework, just pure css

from header.

dbwodlf3 avatar dbwodlf3 commented on July 19, 2024

It works. but. if style not applied. then you need to check h tags are okay.
This tool use just pure css style. if you edit default h tag style, then applied that style.
(css framework like bulma could edit h tags default style.)

from header.

HonestCodeWasTaken avatar HonestCodeWasTaken commented on July 19, 2024

Fixed in NextJS/ChakraUI by adding a global stylesheet inside in _app.tsx file, the css looked like in this pen
https://codepen.io/adamlacombe/pen/LvpJqO

from header.

stevie101 avatar stevie101 commented on July 19, 2024

Just experienced the same issue with Bulma. Found if you wrap the editorjs div with one that includes a content class it stopped overriding the heading tags.

<div class="content"><div id="editorjs"></div></div>

from header.

OFD16 avatar OFD16 commented on July 19, 2024

i need to add several styles on my css when using tailwindcss like :

h1.ce-header{
  @apply text-3xl font-bold
}
h2.ce-header{
  @apply text-2xl font-semibold
}
h3.ce-header{
  @apply text-xl font-semibold
}
h4.ce-header{
  @apply text-lg font-semibold
}
h5.ce-header{
  @apply text-base font-semibold
}
h6.ce-header{
  @apply text-base font-semibold
}

image

this solved my next.js tailwind website for editor.js problem thanks a lot

from header.

code-march avatar code-march commented on July 19, 2024

Reference

Thank you Brother (Solved)

from header.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.