I have a row of cards that are sized so that two fit to the width of the screen then the next two appear below.
I am struggling to get the top of the #card row to be 10px below the #title-row above and to be at the bottom of the #main-container and scrolling if the screen isn't tall enough.
#card-row {
position: relative;
overflow: scroll;
width: 98%;
margin: 0;
bottom: 0;
}
#main-container {
overflow: hidden;
height: 100%;
width: 100%;
}
#title-text {
margin-top: 15px;
margin-bottom: 0px;
font-size: 80px;
color: black;
font-family: "CallingAngelsPersonalUse";
text-shadow: 4px 6px 12px #fff;
}
#date-text {
margin-top: -20px;
margin-bottom: 0px;
font-size: 45px;
color: black;
font-family: "Strawberry_Whipped_Cream";
text-shadow: 2px 4px 6px #fff;
}
#card-title {
font-family: "CallingAngelsPersonalUse";
font-size: 30px;
left: -5px;
bottom: -20px;
}
<div id="main-container" class="container">
<div id="title-row" class="row">
<div class="container center">
<div class="show-on-medium-and-up hide-on-small-only">
<p id="title-text">Scott and Viki</p>
<p id="date-text">23rd June 2018</p>
<a id="button" class="black waves-effect waves-light btn z-depth-3" href="mailto:who#gmail.com?subject=Wedding%20R.S.V.P"><i class="material-icons right">email</i>R.S.V.P</a>
</div>
</div>
</div>
<!-- Agenda Card -->
<div id="card-row" class="row">
<div class="col s12 m6">
<a href="#" onclick="$('#agenda-modal').modal('open');">
<div class="card">
<div class="card-image">
<img src="./assets/SVSunset.jpg" class="z-depth-4">
<span id="card-title" class="card-title">Order of the day</span>
</div>
</div>
</a>
</div>
<!-- Map Card -->
<div class="col s12 m6">
<a href="#" onclick="$('#map-modal').modal('open');" role="button" (click)="openChurchMap()">
<div class="card">
<div class="card-image">
<img src="./assets/1.jpg" class="z-depth-4">
<span id="card-title" class="card-title">Map's and Directions</span>
</div>
</div>
</a>
</div>
6 more cards as above
</div>
Currently, everything is where it should be but when you scroll the cards only move 10px or so. How can I fix this so its dynamic for all screens? Also the #card-row is hugging to the left which i cant get to center either?
Related
I am working on project where in final result, I need to have like this
As you can see in modal, there is background-image and 2 icons, my problem is I don't know how to make it,
I did a div with image background but for icons I have them in psb format and I don't know how to put them on the background in beautiful way .
I tried to screen part of icon and put it but it wasn't good
<section id="about">
<div class="container-fluid mt-0" style="background-image: url(background.png);background-size:cover;height:550px">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading mt-5">Nos activités</h2>
</div>
</div>
<div class="row text-center" >
<div class="col-md-6 image" >
<img src="icon1.png">
</div>
<div class="col-md-6" style="padding-top: 100px">
<img src="icon2.png">
</div>
</div>
<!--
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading ">Nos dernières réalisataions</h2>
</div>
</div>
</div>-->
</section>
This is the structure I'm doing - just replace the images and add the font type
.activities {
background-image: url('http://inspirationhut.net/wp-content/uploads/2013/05/61.png');
background-position: center;
background-size: cover;
width: 100%;
min-height: 100vh;
}
.activities .title {
margin: 0;
padding: 25px 0;
color: #5ABF28;
font-weight: bold;
}
.activities .row {
min-height: calc(100vh - 135px);
align-items: center;
}
.activities .activity {
display: block;
text-decoration: none;
margin: 10px auto;
}
.activities .activity p {
font-weight: bold;
color: #999;
}
.activities .activity button {
width: 30px;
height: 30px;
line-height: 0;
border-radius: 100%;
padding: 0;
margin: 0;
outline: 0;
background: none;
border: 2px solid #aaa;
font-size: 20px;
color: #999;
padding-bottom: 10px;
}
.activities .activity:hover p,
.activities .activity:hover button {
color: #5ABF28;
border-color: #5ABF28;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="activities text-center">
<div class="container">
<h2 class="title pt-5">Nos activités</h2>
<div class="row">
<div class="col-sm">
<a href="#" class="activity">
<img src="https://www.ikea.com/in/en/images/products/smycka-artificial-flower__0903311_PE596728_S5.JPG?f=s" alt="icon 1" height="120" />
<p class="text-uppercase mt-3">entretien de jardin</p>
<button>...</button>
</a>
</div>
<div class="col-sm">
<a href="#" class="activity">
<img src="https://www.ikea.com/us/en/images/products/smycka-artificial-flower-rose-white__0903190_PE596774_S5.JPG" alt="icon 1" height="120" />
<p class="text-uppercase mt-3">creation de jardin</p>
<button>...</button>
</a>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/js/bootstrap.min.js"></script>
I'm trying to get the div with the product name amount price and total to the top of the div it's nestled in, but changing the position isn't working. Stuff like vertical alignment didn't work for me either. I made a screenshot of the page, the buttons are in the right place, it's just the sort of table that has to move to the top of the screen. This has to contain all kinds of products later on.
this is the html:
<div class="checkout">
<div class="container-fluid" style="position: absolute; bottom: 0;">
<!-- Added products overview-->
<div class="checkoutTable">
<div class="row">
<div class="col-4">Product Name</div>
<div class="col-2">Amount</div>
<div class="col-3">Price</div>
<div class="col-3 ">Total</div>
</div>
<hr style="background-color:white;">
<div class="row">
<div class="col-4">Product Name</div>
<div class="col-2">Amount</div>
<div class="col-3">Price</div>
<div class="col-3 ">Total</div>
</div>
</div>
<!-- -->
<!-- Buttons -->
<div class="row">
<a class="checkoutBtn" href="">
<div class="col-12 checkoutBtn">
<i class="fa fa-shopping-cart"></i> Checkout
</div>
</a>
</div>
<div class="row">
<a class="addDiscountBtn" href="#">
<div class="col-6-xs addDiscountBtn">
% Add Discount
</div>
</a>
<a class="cancelBtn" href="#">
<div class="col-6-xs cancelBtn">
<i class="fa fa-ban"></i> Cancel
</div>
</a>
</div>
</div>
</div>
This is the css:
.checkout{
background-color: #22303e;
height: calc(100vh - 50px);
color: white;
font-size: 13px;
}
.checkoutBtn{
background-color: #0090e3; height: 50px;
text-align: center;
line-height: 50px
}
.addDiscountBtn{
background-color:#f8ac59; height: 50px;
text-align: center;
line-height: 50px
}
.cancelBtn{
background-color: #ed5565; height: 50px;
text-align: center;
line-height: 50px
}
a.checkoutBtn{
width: 100%;
color: white;
}
a.addDiscountBtn{
width: 50%;
color: white;
}
a.cancelBtn{
width: 50%;
color: white;
}
a:hover{
text-decoration: none;
opacity: 0.9;
}
.checkoutTable{
vertical-align:top;
}
For container-fluid, do not use any inline styling like you are using style="position: absolute; bottom: 0;"
Example
<div class="checkout">
<div class="container-fluid"></div>
You are placing your div
<div class="checkoutTable">
in parent div
<div class="container-fluid" style="position: absolute; bottom: 0;">
And here the style= "bottom: 0;" that is making everything in it to go at the bottom of the page.
<div class="checkoutTable">
<!--content-->
</div>
<div class="container-fluid" style="position: absolute; bottom: 0;">
<!--content-->
</div>
there is more than one solution for this issue
you can add position like
.Class {
position : absolute;
top : 0;
}
.Class {
position :fixed;
top : 0;
}
I developed a bootstrap card, inside that bootstrap card I am putting another one.
My problem is that when I reduce the screen size the text comes out of the card and also overlays the image, how can I solve this?
Demo
code
<div class="card-deck cardsZone">
<div class="card myCards">
<div class="card-body">
<div *ngFor="let pr of ProgressDashTasks">
<div class="card mysmallCcards">
<div class="card-body">
<div class="row">
<div class="col-sm-2">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgDash">
</div>
<div class="col-sm-8">
<span class="brandName">MY PERCENTAGE</span>
<p class="subtitledash">New percentage</p>
</div>
</div>
<hr class="solid">
<div class="row">
<div class="col-xs-6">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgusersDash">
</div>
<div class="col-xs-6">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgusersDash">
</div>
<div class="col-xs-6">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgusersDash">
</div>
</div>
Card link
Another link
</div>
</div>
</div>
</div>
</div>
</div>
Image Problem
On .cardsZone you have to use a relative width and not an absolute one. Use width: fit-content:
.cardsZone{
margin-top: 5%;
width: fit-content;
height: 70%;
margin-right: auto;
margin-left: auto;
}
.myCards{
background: #E7EAF180 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 20px #BCBCCB47;
border-radius: 8px;
border: none;
}
.card-deck .card {
margin-left: 0px;
}
.mysmallCcards{
width: 100%;
background: #FFFFFF 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 20px #BCBCCB47;
border-radius: 8px;
border: none;
margin-top: 20px;
}
.card-header:first-child {
border-radius: calc(9px - 1px) calc(9px - 1px) 0 0;
}
.mycardHeader{
background-color: white;
}
.imgDash{
width: 40px;
height: 40px;
border-radius: 8px;
}
.brandName{
text-align: left;
font-family: 'Noto Sans', sans-serif;
font-size: 22px;
letter-spacing: 0;
color: #4D4F5C;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 0px;
font-weight: re;
}
.subtitledash{
text-align: left;
font-family: 'Noto Sans', sans-serif;
font-size: 13px;
font-weight: bold;;
letter-spacing: 0;
color: #4D4F5C;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.imgusersDash{
width: 24px;
height: 24px;
transform: matrix(1, 0, 0, 1, 0, 0);
border-radius: 8px;
margin-left: 15px;
}
hr.solid {
border-top: 1px solid #999;
width:100%
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<div class="card-deck cardsZone">
<div class="card myCards">
<div class="card-body">
<div *ngFor="let pr of ProgressDashTasks">
<div class="card mysmallCcards">
<div class="card-body">
<div class="row">
<div class="col-sm-2">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgDash">
</div>
<div class="col-sm-8">
<span class="brandName">MY PERCENTAGE</span>
<p class="subtitledash">New percentage</p>
</div>
</div>
<hr class="solid">
<div class="row">
<div class="col-xs-6">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgusersDash">
</div>
<div class="col-xs-6">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgusersDash">
</div>
<div class="col-xs-6">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/83/Circle-icons-tools.svg/1024px-Circle-icons-tools.svg.png" class="img-responsive imgusersDash">
</div>
</div>
Card link
Another link
</div>
</div>
</div>
</div>
</div>
</div>
Sorry if this is a duplicate question, but I couldn't find an exact match to this which worked, so here it goes.
I have a web page with divs for each database entry. However, the div doesn't resize with text, causing the text to display out of div. I'm using bootstrap.
I've attached a fiddle.
Increase the width of the fiddle output to see the overflowing text.
Currently, i'm working on just the desktop version, but i'll have to build a mobile version as well. So it'll be better if you can help me out with both :)
Below is my code
.each-entry-box {
min-height: 80px;
max-height: 110px;
width: 80%;
background: #F5F5F5;
margin: 10px;
border-radius: 5px;
position: relative;
}
.each-entry-box-header {
height: auto;
width: 100%;
background: #E6E6FA;
margin: 0;
border-radius: 5px;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
position: absolute;
padding: 2px;
}
.main-content {
margin: 15px;
top: 30px;
position: relative;
width: 100%;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="each-entry-box">
<div class="each-entry-box-header">
<div class="col-md-9 customer-name">
<i class="glyphicon glyphicon-user glyphicon-class"></i><span>customer name</span>
</div>
<div class="col-md-3 added-on">
<i class="glyphicon glyphicon-time glyphicon-class"></i><span>time</span>
</div>
</div> <!-- each-entry-box-header ends here -->
<div class="main-content">
<div class="col-md-12">
<div class="col-md-3 customer-mobile">
<i class="glyphicon glyphicon-earphone glyphicon-class"></i><span>mobile number</span>
</div>
<div class="col-md-9 customer-email">
<i class="glyphicon glyphicon-envelope glyphicon-class"></i><span>No email ID added</span>
</div>
</div>
<div class="col-md-12">
Material : None
</div>
<div class="col-md-12">
<div class="col-md-4">
XYZ : None
</div>
<div class="col-md-4">
</div>
<div class="col-md-4">
</div>
</div>
</div>
</div>
Here's a working JS Fiddle,
I've floated both divs and removed the absolute positioning, I've also changed the background colour from the parent element to the child element, so as the list grows, the background will too
HTML:
<div class="each-entry-box">
<div class="each-entry-box-header">
<div class="col-md-9 customer-name">
<i class="glyphicon glyphicon-user glyphicon-class"></i><span>customer name</span>
</div>
<div class="col-md-3 added-on">
<i class="glyphicon glyphicon-time glyphicon-class"></i><span>time</span>
</div>
</div> <!-- each-entry-box-header ends here -->
<div class="main-content">
<div class="col-md-12">
<div class="col-md-3 customer-mobile">
<i class="glyphicon glyphicon-earphone glyphicon-class"></i><span>mobile number</span>
</div>
<div class="col-md-9 customer-email">
<i class="glyphicon glyphicon-envelope glyphicon-class"></i><span>No email ID added</span>
</div>
</div>
<div class="col-md-12">
Material : None
</div>
<div class="col-md-12">
<div class="col-md-4">
XYZ : None
</div>
<div class="col-md-4">
</div>
<div class="col-md-4">
</div>
</div>
</div>
</div>
CSS:
.each-entry-box{
min-height: 80px;
max-height: 110px;
width: 80%;
background: #F5F5F5;
margin: 10px;
border-radius: 5px;
position: relative;
}
.each-entry-box-header{
height: auto;
width: 100%;
background: #E6E6FA;
margin: 0;
border-radius: 5px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
/* position: absolute; */
padding: 2px;
float: left;
}
.main-content{
/* margin: 15px; */
/* top: 30px; */
/* position: relative; */
width: 100%;
background: #F5F5F5;
float: left;
clear: left;
}
.main-content should not have relative position. For mobile responsive styles, you can use col-sm- and col-xs-:
.each-entry-box {
min-height: 80px;
max-height: 110px;
width: 80%;
background: #F5F5F5;
margin: 10px;
border-radius: 5px;
position: relative;
}
.each-entry-box-header {
height: auto;
width: 100%;
background: #E6E6FA;
margin: 0;
border-radius: 5px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
position: absolute;
padding: 2px;
}
.main-content {
margin: 15px;
margin-top: 25px;
width: 100%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="each-entry-box row">
<div class="each-entry-box-header">
<div class="col-md-9 customer-name col-sm-9 col-xs-8">
<i class="glyphicon glyphicon-user glyphicon-class"></i><span>customer name</span>
</div>
<div class="col-md-3 added-on col-sm-3 col-xs-4">
<i class="glyphicon glyphicon-time glyphicon-class"></i><span>time</span>
</div>
</div> <!-- each-entry-box-header ends here -->
<div class="main-content">
<div class="col-md-12">
<div class="col-md-3 customer-mobile col-sm-3">
<i class="glyphicon glyphicon-earphone glyphicon-class"></i><span>mobile number</span>
</div>
<div class="col-md-9 customer-email col-sm-9">
<i class="glyphicon glyphicon-envelope glyphicon-class"></i><span>No email ID added</span>
</div>
</div>
<div class="col-md-12">
Material : None
</div>
<div class="col-md-12">
<div class="col-md-4">
XYZ : None
</div>
<div class="col-md-4">
</div>
<div class="col-md-4">
</div>
</div>
</div>
</div>
I have these 3 column images with title, caption ad icon that I couldn't align properly. Is there way fix the caption and title text according to the image width? What is the best practice to deal with these kind of content? Should I align the CSS for each screen size ?
#import url('http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css');
.urun-text {
position: absolute;
background-color: rgba(15, 15, 15, 0.93);
color: #fff;
bottom: 0px;
text-align: left;
padding: 20px 15px 20px 15px;
}
.urun-title {
position: absolute;
bottom: 80px;
text-align: left;
z-index: 15;
padding-top: 5px;
padding-bottom: 5px;
color: #fff;
padding-left: 20px;
text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
background-color: rgba(194, 0, 0, 0.93);
width: 100%;
}
.click-arrow-right {
position: absolute;
z-index: 16;
color: #fff;
font-size: 10px;
bottom: 0px;
right: 33px;
}
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="product-box">
<img src="http://i.imgur.com/xkAVZ3b.jpg" alt="Yeni Ürünler" class="align-center img-responsive">
<div class="urun-title"><span class="glyphicon glyphicon-star"></span> YENİ ÜRÜNLER</div>
<div class="urun-text">En yeni mobilya konseptlerini görmek için tıklayınız.</div>
<div class="click-arrow-right"><span class="glyphicon glyphicon-arrow-right"></span>
</div>
</div>
</div>
<div class="col-md-4">
<div class="product-box">
<img src="http://i.imgur.com/xkAVZ3b.jpg" alt="Yeni Ürünler" class="align-center img-responsive">
<div class="urun-title"><span class="glyphicon glyphicon-star"></span> YENİ ÜRÜNLER</div>
<div class="urun-text">En yeni mobilya konseptlerini görmek için tıklayınız.</div>
<div class="click-arrow-right"><span class="glyphicon glyphicon-arrow-right"></span>
</div>
</div>
</div>
<div class="col-md-4">
<div class="product-box">
<img src="http://i.imgur.com/xkAVZ3b.jpg" alt="Yeni Ürünler" class="align-center img-responsive">
<div class="urun-title"><span class="glyphicon glyphicon-star"></span> YENİ ÜRÜNLER</div>
<div class="urun-text">En yeni mobilya konseptlerini görmek için tıklayınız.</div>
<div class="click-arrow-right"><span class="glyphicon glyphicon-arrow-right"></span>
</div>
</div>
</div>
</div>
</div
Here you go
http://jsfiddle.net/ajruk60t/3/
.product-box {
display:inline-block;
position:relative;
}
.urun-title {
width:100%;
}
.urun-text {
width:100%;
}
Setting the display to inline-block allows the .product-box to only be as wide as it's content (namely,the image), and position:relative allows us to set the width of the nested .urun-title and .urun-text elements to be 100% of the width of the .product-box.