question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add attributes to<html>

See original GitHub issue

Is your feature request related to a problem?

Sorry if feature exists, couldn’t find Some popular css frameworks such as bulma, tailwind, are using <html class> like fixed-top dark etc… it would be nice to send editable <html> from SSR.

Describe the solution you’d like

./src/root.tsx

Maybe something like this?

    <QwikCity class="dark" data-q="test">
      <head>
        <meta charSet="utf-8" data-q="test"/>
        <RouterHead />
      </head>
      <body lang="en">
        <RouterOutlet />
        <ServiceWorkerRegister />
      </body>
    </QwikCity>

Describe alternatives you’ve considered

Add extra props to QwikCity

Additional context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mheverycommented, Oct 12, 2022

yes, it is part of our i18n prototype

2reactions
zanettincommented, Oct 12, 2022

just a sidenote:

Note that you should use the html element rather than the body element, since the body element doesn’t cover the text inside the document’s head element. source: https://www.w3.org/International/questions/qa-html-language-declarations.en

so if you will provide a feature in the future (maybe when i18n is topic for qwik city?) to set it dynamically it would be very appreciated 🙏 (cc: @mhevery @adamdbradley @manucorporat )

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML Attributes - W3Schools
HTML attributes provide additional information about HTML elements. ... The style attribute is used to add styles to an element, such as color,...
Read more >
How to Add an Attribute to an HTML Tag - ThoughtCo
Learn how to add an attribute to an HTML tag. Attributes provide additional information to the web browser.
Read more >
Element.setAttribute() - Web APIs | MDN
Sets the value of an attribute on the specified element. If the attribute already exists, the value is updated; otherwise a new attribute...
Read more >
How to add attribute to HTML element using javascript
First create the attribute and set the value. Then add it to the element.. var attr = document.createAttribute('step'); attr.value="any"; ...
Read more >
How to add/update an attribute to an HTML element using ...
How to add/update an attribute to an HTML element using JavaScript? · Approach 1: We can use the inbuilt setAttribute() function of JavaScript....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found