Bootstrap 4 Card cutting off div absolute content - css

I'm having an issue where I'm trying to add a rounded icon to the top center of a card, but the part of the icon is cutting off. Need help figuring it out
.header-icon-round {
width: 60px;
height: 60px;
border-radius: 30px;
font-size: 30px;
background-color: #fff;
color: gray;
border: 2px solid #dedede;
position: relative;
margin: 0 auto;
padding: 0;
line-height: 60px;
position: absolute;
top: -10px;
left: 50%;
margin-left: -30px;
}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container-fluid">
<div class="card-columns">
<div class="card card-block text-xs-center">
<div class="header-icon-round">
<i class="ti-wallet"></i>
</div>
<h4 class="card-title" style="padding-top: 80px;">
My title
</h4>
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Pariatur, inventore quod ab.</p>
Button Call
</div>
</div>
</div>
Thank you!

I recently answered the same question here:
Cards crops bootstrap 4
This is a known issue introduced in alpha 4 (will be fixed in alpha 5): https://github.com/twbs/bootstrap/issues/20654
The workaround is to use..
.card-columns .card {
display: inline-block;
width:100%;
}
http://www.codeply.com/go/1V7ssBt8xq

Just remove position: absolute; top: -10px; from .header-icon-round class.
.header-icon-round {
width: 60px;
height: 60px;
border-radius: 30px;
font-size: 30px;
background-color: #fff;
color: gray;
border: 2px solid #dedede;
position: relative;
margin: 0 auto;
padding: 0;
line-height: 60px;
/*position: absolute;*/
/* top: -10px;*/
left: 50%;
margin-left: -30px;
}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container-fluid">
<div class="card-columns">
<div class="card card-block text-xs-center">
<div class="header-icon-round">
<i class="ti-wallet"></i>
</div>
<h4 class="card-title" style="padding-top: 80px;">
My title
</h4>
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Pariatur, inventore quod ab.</p>
Button Call
</div>
</div>
</div>

Related

pictures expand inside the class without being distorted

How do I make the pictures expand inside the class without being distorted and without edges or spaces between each other?
is there any other way to do this with Flexbox? there does not have to be a scrollbar and the .portof {class should not be too big in terms of height
How do I make the pictures expand inside the class without being distorted and without edges or spaces between each other?
is there any other way to do this with Flexbox? there does not have to be a scrollbar and the .portof {class should not be too big in terms of height
<pre>
<section class="Gallery">
<h1>Unsere Praxis</h1>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Voluptatibus tempora accusantium provident ipsum placeat dolorem, dolores tempore optio, dignissimos eaque similique vel ea ullam nobis quas quae fugit laudantium sed!</p>
</section>
<!-- Portofolie -->
<section class="portof">
<div class="row">
<div class="wrapper">
<div class="container"> <img src="https://picsum.photos/350/250/?random=71" alt="?"></div>
<div class="container"> <img src="https://picsum.photos/350/250/?random=41" alt="?"></div>
<div class="container"> <img src="https://picsum.photos/350/250/?random=51" alt="?"></div>
<div class="container"> <img src="https://picsum.photos/350/250/?random=14" alt="?"></div>
<div class="container"> <img src="https://picsum.photos/350/250/?random=1" alt="?"></div>
<div class="container"> <img src="https://picsum.photos/350/250/?random=9" alt="?"></div>
<div class="container"> <img src="https://picsum.photos/350/250/?random=5" alt="?"></div>
<div class="container"> <img src="https://picsum.photos/350/250/?random=2" alt="?"></div>
<div class="container"> <img src="https://picsum.photos/350/250/?random=11" alt="?"></div>
<div class="container"> <img src="https://picsum.photos/350/250/?random=10" alt="?"></div>
</div>
<!-- <div class="gallery-row2">
sssdsd
</div>
--> </div>
</section>
</pre>
.Gallery{
width: 80%;
padding: 2% 0 0 0;
text-align: center;
margin: auto;
}
.Gallery h1{
font-size: 30px;
font-weight: 800;
color: #87CEEB;
}
.Gallery p{
padding-top: 10px;
font-family: 'Poppins', sans-serif;
font-weight: 30;
color: #000;
line-height: 30px;
font-size: 20px;
}
.portof{
width: 100%;
text-align: center;
background-color: royalblue;
background-image: url(img/slider_2.jpg);
background-repeat: no-repeat;
background-position: center;
background-size: cover;
background-color: rgba(0, 0, 0, 0.8);
background-blend-mode: multiply;
clip-path: polygon(51% 19%, 100% 13%, 100% 85%, 51% 94%, 0 85%, 0 13%);
}
.wrapper {
padding: 2% 0 0 0;
font-size: 0;
display: block;
}
.container {
display: inline-block;
width: 20%;
}
img {
display: inline-block;
max-width: 100%;
}
.container:hover{
background-color: rosybrown;
}
Just update CSS class .wrapper display property to be flex and give the container zero padding as following
.wrapper {
padding: 2% 0 0 0;
font-size: 0;
display: flex;
}
.container {
display: inline-block;
width: 20%;
padding: 0;
}

Bootstrap column spacing inconsistent

I have columns on the home page of a website I am building, each containing an icon and text. On mobile, however, the columns stack on top of each other and have inconsistent vertical spacing, due to the inconsistent length of the text. Is there any way to force the columns to have consistent spacing in mobile view?
(If you run the below code snippet, press full page to see the spacing issue I am referring to)
.info-blocks {
margin-bottom: 15px;
/* background: #efefef; */
}
.info-blocks i.icon-info-blocks {
float: left;
color: #FFEB3B;
font-size: 30px;
min-width: 50px;
margin-top: 7px;
text-align: center;
background: #002e5b;
width: 72px;
height: 72px;
padding-top: 7px;
border: 1px solid #002e5b;
border-radius: 50%;
}
.info-blocks .info-blocks-in {
padding: 0 10px;
overflow: hidden;
}
.info-blocks .info-blocks-in h3 {
color: #002e5b;
font-size: 18px;
line-height: 28px;
margin: 0px;
margin-bottom: 8px;
font-family: 'Montserrat', sans-serif;
font-weight: 600;
}
.info-blocks .info-blocks-in p {
font-size: 14px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://code.iconify.design/1/1.0.3/iconify.min.js"></script>
<br>
<body>
<div class="container">
<div class="row">
<div class="col-sm-4 info-blocks">
<i class="icon-info-blocks"><span class="iconify" data-icon="mdi:map-legend" data-inline="false"></span></i>
<div class="info-blocks-in">
<h3>Explore</h3>
<p>Lorem ipsum dolor sit amet</p>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4 info-blocks">
<i class="icon-info-blocks"><span class="iconify" data-icon="mdi:map-legend" data-inline="false"></span></i>
<div class="info-blocks-in">
<h3>Explore</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ut magna eleifend, fermentum arcu et, euismod neque. Sed ante elit.</p>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4 info-blocks">
<i class="icon-info-blocks"><span class="iconify" data-icon="mdi:map-legend" data-inline="false"></span></i>
<div class="info-blocks-in">
<h3>Explore</h3>
<p>Lorem Ipsum</p>
</div>
</div>
</div>
</div>
</body>
You can assign a fixed height to .info-blocks .info-blocks-in
See snippet below (test it at different screen width):
.info-blocks {
margin-bottom: 15px;
/* background: #efefef; */
}
.info-blocks i.icon-info-blocks {
float: left;
color: #FFEB3B;
font-size: 30px;
min-width: 50px;
margin-top: 7px;
text-align: center;
background: #002e5b;
width: 72px;
height: 72px;
padding-top: 7px;
border: 1px solid #002e5b;
border-radius: 50%;
}
.info-blocks .info-blocks-in {
padding: 0 10px;
height:80px;
overflow: hidden;
}
.info-blocks .info-blocks-in h3 {
color: #002e5b;
font-size: 18px;
line-height: 28px;
margin: 0px;
margin-bottom: 8px;
font-family: 'Montserrat', sans-serif;
font-weight: 600;
}
.info-blocks .info-blocks-in p {
font-size: 14px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://code.iconify.design/1/1.0.3/iconify.min.js"></script>
<br>
<body>
<div class="container">
<div class="row">
<div class="col-sm-4 info-blocks">
<i class="icon-info-blocks"><span class="iconify" data-icon="mdi:map-legend" data-inline="false"></span></i>
<div class="info-blocks-in">
<h3>Explore</h3>
<p>Lorem ipsum dolor sit amet</p>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4 info-blocks">
<i class="icon-info-blocks"><span class="iconify" data-icon="mdi:map-legend" data-inline="false"></span></i>
<div class="info-blocks-in">
<h3>Explore</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ut magna eleifend, fermentum arcu et, euismod neque. Sed ante elit.</p>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4 info-blocks">
<i class="icon-info-blocks"><span class="iconify" data-icon="mdi:map-legend" data-inline="false"></span></i>
<div class="info-blocks-in">
<h3>Explore</h3>
<p>Lorem Ipsum</p>
</div>
</div>
</div>
</div>
</body>

Tree Grid Tube Offset

I am trying to create a tube module for a tree grid. I want to keep the tube as one block and have each column as an element within the block. I would like to apply an offset to the tube so the tube below has an indent, but I'm running into an issue with the column borders lining up. How do I apply an offset to the first column of the block without applying it to the whole tube.
Here is the HTML:
<div class="m-tube">
<div class="m-tube__column">
<span class="m-tube__column--icon"></span>
<div class="m-tube__text">Lorem Ipsum</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Tempus Fugit</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Fac Ut Gaudeum</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Lorem Ipsum Dolor Sit Amet</div>
</div>
<div class="m-tube__column m-tube__column--no-border">
<div class="m-tube__text">Caveat Emptor</div>
</div>
</div>
<div class="m-tube">
<div class="m-tube__column">
<span class="m-tube__column--icon"></span>
<div class="m-tube__text">Lorem Ipsum</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Tempus Fugit</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Fac Ut Gaudeum</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Lorem Ipsum Dolor Sit Amet</div>
</div>
<div class="m-tube__column m-tube__column--no-border">
<div class="m-tube__text">Caveat Emptor</div>
</div>
</div>
And here is the SCSS:
.m-tube {
border: 1px solid silver;
border-radius: 3rem;
width: auto;
height: 3.5rem;
display: table;
&:hover {
background-color: lightblue;
}
&--no-end-cap {
border-radius: 3rem 0 0 3rem;
border-right: 0;
}
&__column {
border-right: 1px solid silver;
padding: 0 0.5rem;
height: 100%;
display: inline-table;
//vertical-align: middle;
&--no-border {
border-right: 0;
}
&--icon {
background-color: red;
height: 1.5rem;
width: 1.5rem;
}
}
&__text {
line-height: 3.4rem;
color: #01527a;
font-size: 1.1rem;
font-family: Helvetica, Arial, sans-serif;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
}

Stacked glyphicons with Font Awesome

I have the fa-circle-thin in which i want to place a glyphicon, so that it looks like there is a round border around my glyphicon. I just want to know if this is even possible?
I've tried following:
<div class="col-md-4">
<span class="circle">
<i class="glyphicon glyphicon-star"></i>
</span>
<h4 class="service-heading">Lorem</h4>
<p class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.</p>
</div>
However the two icons shows up side by side. I made a class for my FA that looks like this:
.circle:before {
font-family: fontawesome-webfont;
text-decoration: none;
content: "\f1db";
background-color: transparent;
z-index:-1;
}
I'd just use border-radius: 50% instead of trying to position two glyphs (plus you can style the border!). I'm also centering things with text-align: center and by matching the line-height and height values:
.circle {
border: 1px solid black;
border-radius: 50%;
padding: 3px;
width: 25px;
height: 25px;
display: inline-block;
text-align: center;
line-height: 25px;
}
.alt {
border-width: 2px;
border-color: red;
color: red;
width: 15px;
height: 15px;
line-height: 15px;
}
<div class="circle">
🌟
</div>
<div class="circle alt">
🌟
</div>
How about using posiiton:absolute?
.glyphicon{
position: absolute;
top: 3px;
left: 15px;
}
Result: jsfiddle

Positioning divs with css using absolute positioning

I know this is a noob question, but I just can't figure this out! I'm laying out a page for our intranet and all I need to do is position some divs side by side. Each container is a different item, but all containers have the same structure, a header, some descriptive text, and an image. I will be adding items as they are given to me. This is basically just a page i'm creating for employees to sell items. Here is my css and an image of what I'm trying to achieve. Please let me know if this doesn't make sense, but as smart as you guys have proven to be in the past, i'm sure you get the idea.
.wrapper {
width: 1260px;
height: 900px;
margin: 0px auto;
position: relative;
}
.container {
width: 400px;
height: 400px;
margin: 10px;
position: absolute;
}
.itemText {
width: 350px;
height: 190px;
padding: 0px;
position: absolute;
top: 25px;
left: 25px;
}
.itemHead {
padding: 0px;
margin: 0px;
}
.itemDesc {
padding: 10px;
margin: 0px;
}
.itemThumb {
width: 350px;
height: 150px;
position: absolute;
bottom: 25px;
left: 25px;
}
My HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/text.css">
<link rel="stylesheet" href="css/style.css">
<title>Document</title>
</head>
<body>
<div class="wrapper">
<div class="container">
<div class="itemText">
<div class="itemHead">
<p>Lorem ipsum.</p>
</div>
<div class="itemDesc">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iusto, placeat, aliquid tempore harum similique quo deleniti velit eum labore est?</p>
</div>
</div>
<div class="itemThumb"></div>
</div>
<div class="container">
<div class="itemText">
<div class="itemHead">
<p>Lorem ipsum.</p>
</div>
<div class="itemDesc">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iusto, placeat, aliquid tempore harum similique quo deleniti velit eum labore est?</p>
</div>
</div>
<div class="itemThumb"></div>
</div>
<div class="container">
<div class="itemText">
<div class="itemHead">
<p>Lorem ipsum.</p>
</div>
<div class="itemDesc">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iusto, placeat, aliquid tempore harum similique quo deleniti velit eum labore est?</p>
</div>
</div>
<div class="itemThumb"></div>
</div>
</div>
</body>
</html>
Don't position your containers absolutely.
.container {
width: 400px;
height: 400px;
margin: 10px;
position: relative;
float:left;
}
At the end of the last container div, you'll need a div to clear: left;
<div style="clear:left;"></div>
Now when you add more div's, they will auto float, and the container will get cleared.
Absolute positioning is in that case really useless.
try this:
.container {
position: relative;
float: left;
width: 400px;
height: 400px;
margin: 10px;
}
Your divs have the same height, so using float is pretty convenient. By giving your .container the attribute position: relative .itemThumb is positioned correctly.
This should work
I don't know if I understand exactly
but one way to get the containers to line up is to set the .container class to
.container {
width: 30%;
height: 400px;
margin: 10px;
display: inline-block;
}
Adding the display: inline-block;
And removing the position:absolute.
Setting your width for each container to around 30% of the wrapper will ensure that three containers get lined up before they go to a new line.
You will need to take off all the position: settings IN your css file so that all the information stays contained within the div.
e.g.
.wrapper {
width: 1260px;
height: 900px;
margin: 0px auto;
position: relative;
}
.container {
width: 30%;
height: 400px;
margin: 10px;
display: inline-block;
border: 1px solid black;
}
.itemText {
width: 350px;
height: 190px;
padding: 0px;
top: 25px;
left: 25px;
}
.itemHead {
padding: 0px;
margin: 0px;
}
.itemDesc {
padding: 10px;
margin: 0px;
}
.itemThumb {
width: 350px;
height: 150px;
bottom: 25px;
left: 25px;
}

Resources