Curved corners when an image is located on the border

Looking to create a basic website with React using Reactstrap and Bootstrap. I'm trying to add a custom border-radius to my Cards, but facing an issue where the image inside the Card is overlapping the container on the upper side. Is there a CSS property that can help in smoothing out the image border? How would you tackle this problem?

Component:

import React, { Component } from 'react';
import './App.css';
import logo from '../images/logo.png';
import tile1 from '../images/tile_imgs/prova(m).png';
import tile2 from '../images/tile_imgs/prova(d).png';
import tile3 from '../images/tile_imgs/prova(x).png';
import { Card, CardImg, CardText, CardBody,
   CardTitle, CardSubtitle, Button, Col, Row, Container } from 'reactstrap';
import PropTypes from 'prop-types';

class App extends Component {

  render() {
    return (
     <div> 
        <div className="App">
            <br/>
            <img src={logo} />
          </div>
            <br/>
            <br/>
            <br/>
            <Container className="prova" fluid="true">
              <Row>
                <Col className="frame" xs="12" sm="4">
                  <Card className="card">
                  <CardImg className="cards" src={tile1} />
                    <CardBody>
                      <CardTitle> Recruitment Services</CardTitle>
                      <CardText>Some quick example text to build on the card title and make up the bulk of the card's content.</CardText>
                      <Button>Discover More!</Button>
                    </CardBody>
                  </Card>
                </Col>
                <Col xs="12" sm="4">
                  <Card>
                  <CardImg className="cards" src={tile2} alt="Card image cap" />
                    <CardBody>
                      <CardTitle>Web Design and Web-mastering</CardTitle>
                      <CardText>Some quick example text to build on the card title and make up the bulk of the card's content.</CardText>
                      <Button>Discover More!</Button>
                    </CardBody>
                  </Card>
                </Col>
                <Col xs="6" sm="4">
                  <Card>
                  <CardImg className="cards" src={tile3} alt="Card image cap" />
                    <CardBody>
                      <CardTitle>Digital Marketing</CardTitle>
                      <CardText>Some quick example text to build on the card title and make up the bulk of the card's content.</CardText>
                      <Button>Discover More!</Button>
                    </CardBody>
                  </Card>
                </Col>
              </Row>
              </Container>
              <br/>
              <br/>
     </div>

    );
  }

}


export default App;

CSS

.App {
  text-align: center;
  background-image:
   url('../images/arch1.jpg'), /*put the first one on the Top*/
   url('../images/computer.jpg'),
   url('../images/arch2.jpg');
  animation: animatedBird 30s infinite;
  height: 26rem;
}

@keyframes animatedBird {
  0% {
    background-image: url('../images/arch1.jpg');
  }
  10% {
    background-image: url('../images/arch1.jpg');
  }
  25% {
    background-image: url('../images/computer.jpg');
  }
  35% {
    background-image: url('../images/computer.jpg');
  }
  50% {
    background-image: url('../images/arch2.jpg');
  }
  60% {
    background-image: url('../images/arch2.jpg');
  }
  75% {
    background-image: url('../images/computer.jpg');
  }
  100% {
    background-image: url('../images/arch1.jpg');
  }
}

.App-header {
  background-color: #222;
  height: 150px;
  padding: 20px;
  color: white;
}

.App-title {
  font-size: 1.5em;
}

#navbar {
  height: 150px;
}

.cards {
  max-height: 200px;
  width: auto;
  height: auto;
}

.prova {
  max-width: 80%;
}

.card {
  width: 24rem;
  height: 26rem;
  text-align: center;
  border-radius: 34px !important;
}

.frame {
  border-radius: 34% !important;
}

Answer №1

Experiment using overflow: hidden within the CSS of the element

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Listening for a click event on a newly added element using JQuery

I am relatively new to using JQuery and I have encountered an issue with adding a click event listener for a dynamically created button. When the user clicks on the first button, my function successfully adds a second button to a div. However, I am facing ...

Share edited collection with Observer

The challenge Imagine creating an Angular service that needs to expose an Observable<number[]> to consumers: numbers: Observable<number[]>; Our requirements are: Receive the latest value upon subscription Receive the entire array every tim ...

The transitions in Vue do not seem to be functioning properly when used with router-link and $router

I have the following structure in my App.vue file: <script setup> import { RouterView } from "vue-router"; </script> <template> <RouterView v-slot="{ Component }"> <transition :name="fade" mod ...

Why are only some of my images appearing on the screen?

I am trying to showcase four images - two in the first row and two below it. However, I am facing an issue where only the images in the top row are appearing while the ones in the second row seem to be missing. I'm not sure what is causing this probl ...

Leveraging AJAX, PHP, and MySQL for showcasing tabular information

My goal is to dynamically display a column of data labeled as [pin], depending on the values of [plan] and [order_id]. Specifically, when plan=9 and order_id=0. I am looking to achieve this without having to reload the entire page by utilizing Ajax. Below ...

YUI: Personalizing the message displayed in the browser when cancelling a window close event

I am working on a YUI application that requires me to notify the user before closing the window in certain situations. To achieve this, I have implemented a function to capture the window close event: onWindowClose: function(e) { if (...) ...

Error encountered in vue.js due to a ReferenceError when the resize event is used

I'm having trouble obtaining the window height when resizing, and I keep encountering the error ReferenceError: calcOfSliderHeight is not defined. Can someone explain what's happening? Here is my code: let example = new Vue({ el: '#exam ...

When it comes to printing, the @media rule for portrait orientation will not be effective if landscape orientation is also indicated

My goal is to create a div that will occupy the entire A4 page when printing, regardless of whether portrait or landscape mode is selected in the print dialog window. test.html: <!DOCTYPE html> <html lang="en"> <head> <me ...

Rock Paper Scissors Debugged

Question I have been working on a rock paper scissors game. The functionality I have implemented so far includes: Allowing the player to select a choice The computer randomly selects a choice Changing the images representing the hands based on the choic ...

Missing HTML escape sequences following conversion to a string

The Android test was successfully run using the following code: public static void test() { String text="<html>" + "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=us-ascii\" /> ...

What is the process for SpringBoot to extract the current user from ReactJS?

I am currently delving into the code of a Full-stack web application, which can be found at https://github.com/callicoder/spring-security-react-ant-design-polls-app. However, I am struggling to comprehend how Spring Boot identifies the current user who is ...

Automatically Populate Cells in the Same Row of an Array Form in Angular 9 Reactive Form

Continuing my journey of learning Angular, I have encountered a roadblock once again and could really use some assistance. Situation I have a form that contains a table. The table has multiple cells but it all starts with the user selecting an option fr ...

What is the best way to change the maxWidthLg of Material UI's .MuiContainer?

I need to remove the max-width that is set in the theme. When I look at it in Chrome and uncheck the option, it functions as desired: @media (min-width: 1280px) .MuiContainer-maxWidthLg { max-width: 1280px; } How can I achieve this? I have attempted ...

Does deploying on Heroku cause Material UI makeStyles to disappear?

After deploying to Heroku, I noticed that all my MUI makeStyles calls are being removed, causing a major issue with the appearance of my app. Before resorting to inline styling (which I tested and confirmed works), I wanted to seek advice on this matter. ...

When the browser window is resized, the footer starts to cover the content

To prevent the divs from overlapping when the browser window is resized vertically, take a look at the code snippet below: <html> <body> <style> #box { display: flex; flex-direction ...

What is the best way to conceal the chat icon in a bot interface?

I've successfully integrated Bot Press into my React web application and it's functioning as expected. However, I'm facing an issue where I need to close the chat icon when a user logs out of the web app. Although manually refreshing the pag ...

How to pass model from NodeJS and ExpressJS to Knockout using Jade?

Currently, I am facing a challenge in passing my expressJS Model to my .jade template while trying to access the Model using JavaScript on the client-side. The concept is straightforward: I am looking to utilize the Model with Knockout.js, therefore requi ...

Tips for achieving full width design within a container

Hello everyone, I require some assistance. I am attempting to create a full-width navigation while being constrained by a wrapper div with a fixed width of 900. I am unsure of how to achieve this without creating an additional div like the header. I am see ...

When editing html files in Vim, the javascript indent filetype plugin is sourced unexpectedly

After experimenting with my vim settings, I noticed an unexpected behavior. When editing html files in vim, both the indent/javascript.vim and indent/html.vim filetype plugins seem to be sourced simultaneously. Is this intentional or a bug? How can I ensur ...

Displaying a div upon clicking a hyperlink

I am currently working on designing an unordered list that serves as a family tree. My goal is to enable users to click on each section, triggering the appearance of a new div in the center of the screen containing relevant details about that specific pers ...