Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Div is ignoring whatever styling I put on it

We are doing a youtube clone for a project and I’m trying to style it. Regardless of what I put for styling it disregards it and nothing is applied.
I have tried adding it on the main div, the link, and it still doesn’t work. Any help will be greatly appreciated

import React from "react";
import { Link } from "react-router-dom";


const DisplayVideos = ({videos}) => {

    return ( 
        <div >
            {videos.map((video, index) => {
                // get video id
                return (
                    <div  style={{'margin-bottom': '80px'}}>
                        <Link to={`/video/${video.id.videoId}`}>
                            <div key={index}>
                                <img src={video.snippet.thumbnails.medium.url} alt="" />
                            </div>
                            <div>
                                <div >{video.snippet.title}</div>
                            </div> 
                        </Link>
                    </div>
                );
            })}
        </div>
    );
}
 
export default DisplayVideos;

styles page:
.display-title{
    font-family: Arial, Helvetica, sans-serif;
    font-size: 20px;
    color: rgb(29, 50, 67);
}
.display-description{
    font-family: Arial, Helvetica, sans-serif;
    font-size: 20px;
    color: rgb(0, 0, 0);
}

Link{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
  
    /* CSS just to show the bounds */
    border: 2px solid;
    background-color: #eee

}
.text {
    width: 20%;
    inline-size: 10px; 
    overflow-wrap: break-word;
  }

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

With react you have to use lowerCamelCase for CSS atributes.
Try marginBottom instead of margin-bottom in your component.

Use className=’class1 class2 etc.’ if you want to use CSS classes in HTML elements

<div className='class1 class2 etc.'>

Or

<div style={{marginBottom: '80px'}}>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading