I have a image picture card. I would like to have rounded border around the whole card. How would I do conduct this? It does not seem to be working property.
Does anyone know the property in CSS or HTML? The following did not work after doing border-radius property:. I would like to do it around the card image, instead of the images. We have a 3X3 square gallery, or 4X4 gallery soon, so maybe more difficult to code.
I want the actual images rounded off, not a rounded box
border-radius: 25px;
.card { border-color: black; border-radius: 25px; border-style: solid; border-width: 1px; width: 100%; margin-right: 0; padding: 0; } .card-header { background-color: white; } .card-body { background-color: white; } .cardcheckbox { position: absolute; right: 5px; top: 5px; /*vertical-align: middle; float: right;*/ visibility: hidden; } input[type=checkbox]:checked { visibility: visible; } .card:hover .cardcheckbox { visibility: visible; } .material-icons { display: inline-flex; vertical-align: top; } .card-header .accordion-toggle { &.collapsed:after { font-family: 'Material Icons'; content: "\\e5cf"; } &:after { font-family: 'Material Icons'; content: "\\e5ce"; float: right; color: grey; } }
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <div class="card" style="width: 30.00rem"> <div aria-multiselectable="true" class="accordian md-accordion" id="accordionEx" role="tablist"> <div class="grid-container" id="gridid531937b3b9b54801ab80573cf91d0852" style=" display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(1, 1fr); grid-gap: 0em; padding: 0px; align-items: stretch; position: relative; "><input class="cardcheckbox" id="checkid" type="checkbox"><img id="imgid531937b3b9b54801ab80573cf91d08520" src="https://www.woodlandtrust.org.uk/media/100078482/Sycamore01.jpg?cb=-11897985&preset=gallery-tab-main-image" style="max-width: 100%; max-height: 100%; padding: 0px; background-color: white;"><img id="imgid531937b3b9b54801ab80573cf91d08521" src="https://statesymbolsusa.org/sites/statesymbolsusa.org/files/styles/symbol_thumbnail__medium/public/primary-images/Applesfreshpicked.jpg?itok=YmYkBfY7" style="max-width: 100%; max-height: 100%; padding: 0px; background-color: white;"><img id="imgid531937b3b9b54801ab80573cf91d08522" src="https://openbookphilly.com/wp-content/uploads/2016/11/bookstack.png" style="max-width: 100%; max-height: 100%; padding: 0px; background-color: white;"></div> <div class="card-header" id="headingOne1" role="tab"><a aria-controls="id531937b3b9b54801ab80573cf91d0852" aria-expanded="true" class="accordion-toggle collapsed" data-parent="#accordionEx" data-toggle="collapse" href="#id531937b3b9b54801ab80573cf91d0852">Tree</a></div> <div aria-labelledby="headingOne1" class="collapse" data-parent="#accordionEx" id="id531937b3b9b54801ab80573cf91d0852" role="tabpanel"> <div class="card-body">Tree with leaves</div> </div> </div> </div>
Add Padding in .card class, because inner content over-righting the border radius
.card {
border-color: black;
border-radius: 25px;
border-style: solid;
border-width: 1px;
width: 100%;
margin-right: 0;
padding: 10px;
}
Updated Code:
<html>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<style>
.card {
border-color: black;
border-radius: 25px;
border-style: solid;
border-width: 1px;
width: 100%;
margin-right: 0;
padding: 10px;
}
.card-header {
background-color: white;
}
.card-body {
background-color: white;
}
.cardcheckbox {
position: absolute;
right: 5px;
top: 5px;
/*vertical-align: middle;
float: right;*/
visibility: hidden;
}
input[type=checkbox]:checked {
visibility: visible;
}
.card:hover .cardcheckbox {
visibility: visible;
}
.material-icons {
display: inline-flex;
vertical-align: top;
}
.card-header .accordion-toggle {
&.collapsed:after {
font-family: 'Material Icons';
content: "\e5cf";
}
&:after {
font-family: 'Material Icons';
content: "\e5ce";
float: right;
color: grey;
}
}
</style>
<div class="card" style="width: 30.00rem">
<div aria-multiselectable="true" class="accordian md-accordion" id="accordionEx" role="tablist">
<div class="grid-container" id="gridid531937b3b9b54801ab80573cf91d0852" style=" display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(1, 1fr);
grid-gap: 0em;
padding: 0px;
align-items: stretch;
position: relative; "><input class="cardcheckbox" id="checkid" type="checkbox"><img
id="imgid531937b3b9b54801ab80573cf91d08520"
src="https://www.woodlandtrust.org.uk/media/100078482/Sycamore01.jpg?cb=-11897985&preset=gallery-tab-main-image"
style="max-width: 100%; max-height: 100%; padding: 0px; background-color: white;"><img
id="imgid531937b3b9b54801ab80573cf91d08521"
src="https://statesymbolsusa.org/sites/statesymbolsusa.org/files/styles/symbol_thumbnail__medium/public/primary-images/Applesfreshpicked.jpg?itok=YmYkBfY7"
style="max-width: 100%; max-height: 100%; padding: 0px; background-color: white;"><img
id="imgid531937b3b9b54801ab80573cf91d08522"
src="https://openbookphilly.com/wp-content/uploads/2016/11/bookstack.png"
style="max-width: 100%; max-height: 100%; padding: 0px; background-color: white;"></div>
<div class="card-header" id="headingOne1" role="tab"><a aria-controls="id531937b3b9b54801ab80573cf91d0852"
aria-expanded="true" class="accordion-toggle collapsed" data-parent="#accordionEx"
data-toggle="collapse" href="#id531937b3b9b54801ab80573cf91d0852">Tree</a></div>
<div aria-labelledby="headingOne1" class="collapse" data-parent="#accordionEx"
id="id531937b3b9b54801ab80573cf91d0852" role="tabpanel">
<div class="card-body">Tree with leaves</div>
</div>
</div>
</div>
You can see like this just make a few changes like this, Click and see my result
Create CSS class imgsize and imgfirst like below, And delete all the styles in HTML file your three images.
<img class="imgfirst" id="imgid531937b3b9b54801ab80573cf91d08520" src="https://www.woodlandtrust.org.uk/media/100078482/Sycamore01.jpg?cb=-11897985&preset=gallery-tab-main-image">
<img class="imgsize" id="imgid531937b3b9b54801ab80573cf91d08521" src="https://statesymbolsusa.org/sites/statesymbolsusa.org/files/styles/symbol_thumbnail__medium/public/primary-images/Applesfreshpicked.jpg?itok=YmYkBfY7">
<img class="imgsize" id="imgid531937b3b9b54801ab80573cf91d08522" src="https://openbookphilly.com/wp-content/uploads/2016/11/bookstack.png" >
.imgsize{
width: 100px;
height: 100px;
padding-top: 12px;
}
.imgfirst{
width: 100px;
height: 100px;
padding-top: 12px;
padding-left: 12px;
}
Then edit "card" and "card-header" class in CSS,
.card {
margin-top: 10px;
margin-left: 10px;
border-color: black;
border-radius: 10px;
border-style: solid;
border-width: 1px;
width: 100%;
margin-right: 0;
padding: 0;
}
.card-header {
margin-left: 10px;
margin-right: 10px;
background-color: white;
}
Will implement the
overflow:hidden on the container
as Paulie D recommended. Paulie D is free to recopy into his own answer, so I can send points.
Thanks,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.