By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
rocoderesrocoderes
  • Home
  • HTML & CSS
    • Login and Registration Form
    • Card Design
    • Loader
  • JavaScript
  • Python
  • Internet
  • Landing Pages
  • Tools
    • Google Drive Direct Download Link Generator
    • Word Count
  • Games
    • House Painter
Notification Show More
Latest News
How to set the dropdown value by clicking on a table row
Javascript – How to set the dropdown value by clicking on a table row
JavaScript
Attempting to increase the counter, when the object's tag exist
Javascript – Attempting to increase the counter, when the object’s tag exist
JavaScript
Cycle2 JS center active slide
Javascript – Cycle2 JS center active slide
JavaScript
Can import all THREE.js post processing modules as ES6 modules except OutputPass
Javascript – Can import all THREE.js post processing modules as ES6 modules except OutputPass
JavaScript
How to return closest match for an array in Google Sheets Appscript
Javascript – How to return closest match for an array in Google Sheets Appscript
JavaScript
Aa
Aa
rocoderesrocoderes
Search
  • Home
  • HTML & CSS
    • Login and Registration Form
    • Card Design
    • Loader
  • JavaScript
  • Python
  • Internet
  • Landing Pages
  • Tools
    • Google Drive Direct Download Link Generator
    • Word Count
  • Games
    • House Painter
Follow US
High Quality Design Resources for Free.
rocoderes > JavaScript > Javascript – Some css properties aren’t showing up when i use js/ts to make the stylesheet
JavaScript

Javascript – Some css properties aren’t showing up when i use js/ts to make the stylesheet

Admin
Last updated: 2023/12/11 at 4:10 PM
Admin
Share
2 Min Read
Some css properties aren't showing up when i use js/ts to make the stylesheet

Problem:

I like to create all of my css for my react apps using js/ts instead of css but I’ve discovered that some of the properties don’t register with the browser when I do this. These exact same properties in a .css file work perfectly fine.

Contents
Problem:Solution:

Here’s what I mean:

styles.ts

'contactSection': {
     'position':'relative',
     'display': 'flex',
     'flexDirection': 'row',
     'alignItems': 'flexEnd',
     'gap':'2em',
     'padding' : '2em',
     'width': '100%',
     'height': '50%',
     'alignSelf': 'flexEnd',
     'justifyContent': 'flexEnd'
  }

All of the above work fine except justifyContent and alignItems.

But when I put justifyContent and alignItems in a .css file like so:

#contactSection{
    align-items : flex-end;
    align-content: flex-end;
}

they work just fine and everything looks great.

why is this? are there specific other properties that could be overriding these properties.
I don’t think this is the issue because they don’t even show up on the dev tools.

I don’t know if i’m overlooking something or what any advice would be great

thanks

Some of the properties don’t register with the browser when U use js/ts

Solution:

In your styles.ts file, change alignItems, alignSelf and justifyContent properties to:

'alignItems': 'flex-end',
'alignSelf': 'flex-end',
'justifyContent': 'flex-end',

Also make sure that no other CSS styles are being applied to the element, which might override the styles you’re setting in your JavaScript/TypeScript.

Related

Subscribe to Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

Share this Article
Facebook Twitter Email Print
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article In React js, how to swap a two select component values onClick? Javascript – In React js, how to swap a two select component values onClick?
Next Article Find available time slots between events with Google Calendar API in js Javascript – Find available time slots between events with Google Calendar API in js
Leave a comment Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

- Advertisement -

You Might Also Like

How to set the dropdown value by clicking on a table row

Javascript – How to set the dropdown value by clicking on a table row

February 11, 2024
Attempting to increase the counter, when the object's tag exist

Javascript – Attempting to increase the counter, when the object’s tag exist

February 11, 2024
Cycle2 JS center active slide

Javascript – Cycle2 JS center active slide

February 10, 2024
Can import all THREE.js post processing modules as ES6 modules except OutputPass

Javascript – Can import all THREE.js post processing modules as ES6 modules except OutputPass

February 10, 2024
rocoderesrocoderes
Follow US

Copyright © 2022 All Right Reserved By Rocoderes

  • Home
  • About us
  • Contact us
  • Disclaimer
Join Us!

Subscribe to our newsletter and never miss our latest news, podcasts etc.

Zero spam, Unsubscribe at any time.
Welcome Back!

Sign in to your account

Lost your password?