Description does not show in the right position - css

I have a grid of images like this:
<div class="city-container container" id="popupContainer">
<div class="row">
<div class="col col-33">
<img src="img/images/opera.jpg" ng-click="showTabDialogOpera($event)"/>
<div class="description" style="font-size: 8pt"><strong>Opera de Lyon</strong></div>
</div>
<div class="col col-33">
<img src="img/Image1.jpg" ng-click="showTabDialogBasilique($event)"/>
<div class="description" style="font-size: 8pt"><strong>Basilique de Fourvière</strong></div>
</div>
<div class="col col-33">
<img src="img/images/hoteldeville.jpg" ng-click="showTabDialogHotel($event)"/>
<div class="description" style="font-size: 8pt"><strong>Hotel de villde de Lyon</strong></div>
</div>
</div>
The problem is that the description does not show in the right position.
CSS:
.city-container .description {
position: absolute;
width: 90%;
text-align: center;
padding: 5px;
line-height: 1.5;
background-color: rgba(204, 204, 204, 0.6);
}

I'm not really sure what you're trying to achieve.
If you want the description to show up next to the image, try relpacing
position: absolute;
with
display: inline-block;
Update
I have updated the CSS. Sorry for the delay.
I scaled the image to fit the width of the column. Hope that meets your requirement.
.col-33 {
width: 32%;
display: inline-block;
}
.col-33 img {
width: 100%;
}
.col-33 .description {
width: 100%;
text-align: center;
padding: 5px 0px;
line-height: 1.5;
background-color: rgba(204, 204, 204, 0.6);
}
<div class="city-container container" id="popupContainer">
<div class="row">
<div class="col col-33">
<img src="http://dummyimage.com/150x50/00cf75/fff.png&text=IMG" ng-click="showTabDialogOpera($event)"/>
<div class="description" style="font-size: 8pt"><strong>Opera de Lyon</strong></div>
</div>
<div class="col col-33">
<img src="http://dummyimage.com/150x50/00cf75/fff.png&text=IMG" ng-click="showTabDialogBasilique($event)"/>
<div class="description" style="font-size: 8pt"><strong>Basilique de Fourvière</strong></div>
</div>
<div class="col col-33">
<img src="http://dummyimage.com/150x50/00cf75/fff.png&text=IMG" ng-click="showTabDialogHotel($event)"/>
<div class="description" style="font-size: 8pt"><strong>Hotel de villde de Lyon</strong></div>
</div>
</div>

Related

CSS text side by side same height

I am trying to make this text
but how can I make it same height and make inline each other
<div class="row">
<div class="col-xs-12 text-center">
<p style="display:inline">初期費用 <br> 月額費用 <br>手続き料</p>
<h3 style="display:inline">0<span>円</span></h3>
</div>
</div>
Try this:
p, h3{
display: inline-block;
}
h3 {
color: skyblue;
font-size: 70px;
}
<div class="row">
<div class="col-xs-12 text-center">
<p>初期費用 <br> 月額費用 <br>手続き料</p>
<h3>0<span>円</span></h3>
</div>
</div>
Using display flex
.col-xs-12 {
display: flex;
align-items: center;
padding: 0;
}
p {
font-size: 16px;
line-height: 1.5;
margin-right: 8px;
}
h3 {
font-size: 102px;
margin: 0;
}
h3 span {
font-size: 32px
}
<div class="row">
<div class="col-xs-12 text-center container">
<p>初期費用 <br> 月額費用 <br>手続き料</p>
<h3>0<span>円</span></h3>
</div>
</div>
Here you go with a solution
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet"/>
<div class="row">
<div class="col-xs-12 text-center">
<div style="display: flex;">
<p style="display: inline-flex">初期費用 <br> 月額費用 <br>手続き料</p>
<h3 style="display: inline-flex">0<span>円</span></h3>
</div>
</div>
</div>
Solution using flex & inline-flex

css border size over my title and after a image

I'm having trouble trying to implement the styling shown in this image using CSS. My problem is how to make the horizontal yellow line over the title "nossos numeros" and the vertical blue lines between "Cursos", "Alunos" and "Aulas".
I'm using also Bootstrap 4.
I want this:
I did this:
<section class="bg-light" id="portfolio" style="background-color: #ffffff;">
<div class="container-fluid">
<div class="row text-center">
<div class="col-sm-3">
<p class="font-square2" style="border-top: 5px yellow solid;">
NOSSOS <br> NÚMEROS</p>
</div>
<div class="col-sm-3" style="padding-top: 50px; border-right: 1px blue solid; ">
<img class="img-fluid" src="img/icone_cursos.png">
<div class="portfolio-caption">
<p class="font-square"> 1123 </p>
<p class="font-square"><strong>Cursos</strong></p>
</div>
</div>
<div class="col-sm-3" style="padding-top: 50px; border-right: 1px blue solid;">
<img class="img-fluid" src="img/icone_alunos.png">
<div class="portfolio-caption">
<p class="font-square"> 34534 </p>
<p class="font-square"><strong>Alunos</strong></p>
</div>
</div>
<div class="col-sm-3" style="padding-top: 65px;">
<img class="img-fluid" src="img/icone_aulas.png">
<div class="portfolio-caption">
<p class="font-square"> 4566 </p>
<p class="font-square"><strong>Aulas</strong></p>
</div>
</div>
</div>
</div>
</section>
but now how I can set the size of the border that I want with a color ?
Thanks in advance!
In this way you can't. You have to use preudoelements. Example:
div {
width : 200px;
height : 50px;
}
div:before {
content : "";
position: absolute;
left : 0;
bottom : 0;
height : 1px;
width : 50%;
border-bottom:1px solid yellow;
}
<div>Item 1</div>
<div>Item 2</div>
You can use pseudo elements for this
Try this
#fortopborder:before {
height: 10px;
display: block;
width: 100px;
background: red;
content: '';
}
#forrightborder:after {
display: block;
content: '';
background: blue;
Width: 10px;
height: 100px;
margin-top: -120px;
Float:right;
}

Keep text aligned top and image aligned to the bottom of relative height divs

I have 4 columns of products with a header, description and image below and I want the text areas to at the top and the images to each line up at the bottom so they stay aligned when the screen is resized.
At the moment the images move up and down as the text wraps - which looks very untidy as they each have a different amount of text.
I have tried using tables and position absolute and they each cause problems and don't work properly.
Here is my code:
#product-landing .landing-row {
position: relative;
height: inherit;
}
.product-landing,
.product-landing-2,
.product-landing-3 {
margin-right: 2.0533%;
}
.product-landing,
.product-landing-2,
.product-landing-3,
.product-landing-4 {
margin-left: 0px;
display: inline-block;
position: relative;
height: 100%;
vertical-align: top;
width: 22.978%;
}
.product-landing-4 {
margin-right: 0px;
}
#product-landing p {
margin-top: 0px;
margin-bottom: 5px;
clear: both;
width: 100%;
}
.product-landing .land-image {
vertical-align: bottom;
}
.product-landing img,
.product-landing-2 img,
.product-landing-3 img,
.product-landing-4 img {
margin-top: 10px;
display: block;
max-width: 350px;
margin: 0 auto;
bottom: 0px;
width: 100%;
}
<div id="product-landing">
<div class="landing-row">
<div class="product-landing">
<div id="product-text">
<div id="offer-title">Product1</div>
<p>
</p>
<p><b><i>Product description</i></b></p>
</div>
<p class="land-image">
<img src="http://image1.jpg">
</p>
</div>
<div class="product-landing-2">
<div id="product-text">
<div id="offer-title">Product2</div>
<p>
</p>
<p><b><i>Product description</i></b></p>
</div>
<p class="land-image">
<img src="http://image2.jpg">
</p>
</div>
<div class="product-landing-3">
<div id="product-text">
<div id="offer-title">Product3</div>
<p>
</p>
<p><b><i>Product description</i></b></p>
</div>
<p class="land-image">
<img src="http://image3.jpg">
</p>
</div>
<div class="product-landing-4">
<div id="product-text">
<div id="offer-title">Product4</div>
<p>
</p>
<p><b><i>Product description</i></b></p>
</div>
<p class="land-image">
<img src="http://image4.jpg">
</p>
</div>
</div>
</div>
You can use flexbox for this
#product-landing .landing-row {
display:flex;
flex-direction:row;
justify-content:space-between;
flex-wrap:wrap;
}
#product-landing p {
margin-top: 0px;
margin-bottom: 5px;
}
.product-landing {
display:flex;
flex-direction:column;
width: 22.978%;
}
.product-landing img {
margin-top: 10px;
display: block;
max-width: 350px;
width: 100%;
}
.product-text {
flex-grow:1;
}
<div id="product-landing">
<div class="landing-row">
<div class="product-landing">
<div class="product-text">
<div class="offer-title">Product1</div>
<p><b><i>Product description</i></b></p>
</div>
<p class="land-image">
<img src="http://via.placeholder.com/350x150">
</p>
</div>
<div class="product-landing">
<div class="product-text">
<div class="offer-title">Product2</div>
<p><b><i>Product description</i></b></p>
</div>
<p class="land-image">
<img src="http://via.placeholder.com/350x150">
</p>
</div>
<div class="product-landing">
<div class="product-text">
<div class="offer-title">Product2</div>
<p><b><i>Product description</i></b></p>
</div>
<p class="land-image">
<img src="http://via.placeholder.com/350x150">
</p>
</div>
<div class="product-landing">
<div class="product-text">
<div class="offer-title">Product3</div>
<p><b><i>Product description Product description Product description</i></b></p>
</div>
<p class="land-image">
<img src="http://via.placeholder.com/350x150">
</p>
</div>
<div class="product-landing">
<div class="product-text">
<div class="offer-title">Product4</div>
<p><b><i>Product description</i></b></p>
</div>
<p class="land-image">
<img src="http://via.placeholder.com/350x150">
</p>
</div>
</div>
Would've commented this if I could; Have you tried using flex-box? https://css-tricks.com/snippets/css/a-guide-to-flexbox/
This has saved me on many occasions where relative/absolute combinations fail.
To be more specific;
.wrapper{
display:flex;
flex-direction:column;
}
.text-wrapper-div{
align-self:flex-start;
}
.image-wrapper-div{
align-self:flex-end;
}
.wrapper is your parent-container, which flexes from top to bottom (column).
Inside are the two div's for text and image, which align themselves to the top (flex-start) and bottom (flex-end).
Have a look at the link if you get stuck - it's pretty well documented I think! Good luck.
Hope this may help you,
Using flex is considered to be best practice. The table and table-cell are the old ways as we have came way far and new properties are being invented day by day. As using the flex will adjust the content itself as you resize the browser and has its own qualities.
#product-landing .landing-row {
display: flex;
flex-direction: row;
}
.product-landing,
.product-landing-2,
.product-landing-3 {
margin-right: 2.0533%;
}
.product-landing,
.product-landing-2,
.product-landing-3,
.product-landing-4 {
flex: 1;
text-align: center;
}
#product-landing p {
margin-top: 0px;
margin-bottom: 5px;
clear: both;
width: 100%;
}
.product-landing .land-image {
vertical-align: bottom;
}
.product-landing img,
.product-landing-2 img,
.product-landing-3 img,
.product-landing-4 img {
margin-top: 10px;
display: block;
max-width: 350px;
margin: 0 auto;
bottom: 0px;
width: 100%;
}
<div id="product-landing">
<div class="landing-row">
<div class="product-landing">
<div id="product-text">
<div id="offer-title">Product1</div>
<p>
</p>
<p><b><i>Product description</i></b></p>
</div>
<p class="land-image">
<img src="http://image1.jpg">
</p>
</div>
<div class="product-landing-2">
<div id="product-text">
<div id="offer-title">Product2</div>
<p>
</p>
<p><b><i>Product description</i></b></p>
</div>
<p class="land-image">
<img src="http://image2.jpg">
</p>
</div>
<div class="product-landing-3">
<div id="product-text">
<div id="offer-title">Product3</div>
<p>
</p>
<p><b><i>Product description</i></b></p>
</div>
<p class="land-image">
<img src="http://image3.jpg">
</p>
</div>
<div class="product-landing-4">
<div id="product-text">
<div id="offer-title">Product4</div>
<p>
</p>
<p><b><i>Product description</i></b></p>
</div>
<p class="land-image">
<img src="http://image4.jpg">
</p>
</div>
</div>
</div>

Working on page flow in responsiveness using css and images

I am working on the below reference image work on responsiveness using css media query and images. I am trying to avoid position I am not getting the excact output which I required.
Here is my Fiddle link
Here is my HTML Code
<div class="container-fluid">
<div class="row-fluid">
<div class="flw_width">
<label class="pull-left flw_text green_prog_text">Basic Information</label>
<div class="col-xs-4 col-sm-4 col-md-1">
<div class="flw_circle_green">
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-3">
<div class="green_prog">
</div>
</div>
<label class="pull-left flw_text cst_text">Education & Health</label>
<div class="col-xs-4 col-sm-4 col-md-1">
<div class="flw_circle_grey">
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-3">
<div class="grey_prog">
</div>
</div>
<label class="pull-left flw_text cst_text">Attach & Declaration</label>
<div class="col-xs-4 col-sm-4 col-md-1">
<div class="flw_circle_grey">
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-3">
<div class="grey_prog">
</div>
</div>
<label class="pull-left flw_text pay_text">Payment</label>
<div class="col-xs-4 col-sm-4 col-md-1">
<div class="flw_circle_grey">
</div>
</div>
</div>
</div>
</div>
My CSS Code
.flw_width{
width: 480px;
margin: 0px auto;
padding-top:45px;
padding-bottom: 60px;
}
.flw_text{
font-size: 13px;
color: #ced3d0;
font-family: 'Open Sans', sans-serif;
width: 0px;
white-space: nowrap;
margin-top: -35px;
margin-left: -45px;
border:0px;
}
.flw_text, .cst_text{
margin-left: -46px !important;
}
.pay_text{
padding-left:26px;
}
.flw_circle_grey{
background: url(../images/grey_Circle.jpg) no-repeat;
width: 20px;
height: 20px;
margin-left: -35px;
margin-top: -7px;
}
.flw_circle_green{
background: url(../images/green_Circle.jpg) no-repeat;
width: 20px;
height: 20px;
margin-top: -6px;
margin-left: 0px;
}
.grey_prog{
background-color: #ced3d0;
height: 6px;
margin-left: -24px;
border: 1px solid #bdbdbd;
}
.green_prog_text{
color: #84bd00;
}
.green_prog{
background-color: #84bd00;
height: 6px;
margin-left: -24px;
}
My current output was like this.
Here is the reference image. Kindly help me I was struggling like anything.
Please do the needful.
You have selected the column grid wrongly, I think For the class which are representing the font awesome circle (green dot) fa fa-circle flw_circle_green can be changed to single grid where you have defined a 4 column grid.
Try updating the four column grid to one column 1 column and use the

How can i get dynamic Google Now style cards using just css/html

First question here.
I'm trying to get google now cards that maintain their width, vertical position relative to other cards, and size relative to their content. Like this that compresses to one column when the window resizes small enough.
I have this, which works until you have a third card, or until the second card has more content than the first.
body {
background-color: #f1f1f3;
margin:auto;
}
h1 {
color:white;
font-family:"Roboto";
font-weight:100;
font-size:36px;
}
h2 {
font-family:'Roboto';
font-weight:100;
font-size:30px;
color:#212121;
}
h4 {
font-family:'Roboto';
font-weight:400;
font-style: italic;
font-size:16px;
color: #727272;
border-top: 1px solid #727272;
padding-top: 4px;
}
p {
font-family:'roboto';
font-weight:400;
font-size:20px;
color:#727272;
}
.content-link {
color:#212121;
text-decoration: none;
font-weight:700;
}
.card-track {
width:100%;
height: auto;
position:relative;
}
.card {
width: 466px;
margin: 15px;
background-color:white;
border-radius: 4px;
float:left;
}
.card-color {
width:466px;
height: 96px;
background-color: #395a66;
position:absolute;
border-radius: 4px 4px 0px 0px;
}
.card-icon {
height: 46px;
width:46px;
margin: 25px;
float:left;
}
.card-icon-img {
max-height: 48px;
height: auto;
-webkit-filter: invert(100%);
}
.card-content-icon-img {
max-height: 50px;
height: auto;
-webkit-filter: opacity(55%);
}
.card-color-title {
margin:27px;
}
#gamingthronebar {
background-color:#FFC107;
}
#colorbar {
background-color:#673AB7;
}
.card-content {
padding:100px 30px 20px 60px;
}
.card-content-icon {
float:left;
width:60px;
height:60px;
margin:120px 0px 0px 24px;
}
<link href='http://fonts.googleapis.com/css?family=Roboto:400italic,100,700,400' rel='stylesheet' type='text/css'>
<body>
<div class="card-track">
<!-- Card
<div class="card">
<span class="card-color">
<div class="card-icon"><img class="card-icon-img" src=""></div>
<h1 class="card-color-title"></h1>
</span>
<div class="card-content-icon"><img class="card-content-icon-img" src=""></div>
<div class="card-content">
<p></p>
<h4></h4>
</div>
</div><!--End Card-->
<div class="card">
<span class="card-color">
<div class="card-icon"><img class="card-icon-img" src="material-design-icons/verification24.png"></div>
<h1 class="card-color-title">Hello, World!</h1>
</span>
<div class="card-content-icon"><img class="card-content-icon-img" src="material-design-icons/android11.png"></div>
<div class="card-content">
<p>Take a look around this site, it's designed based upon the glorious look and feel of <a class="content-link" href="http://www.google.com/design/spec/material-design/introduction.html">Material Design</a>, a visual scheme designed by Google for use with Android 5.0 Lollipop. </p>
</div>
</div><!--End Card-->
<div class="card">
<span class="card-color" id="colorbar">
<div class="card-icon"><img class="card-icon-img" src="material-design-icons/good4.png"></div>
<h1 class="card-color-title">No Java required</h1>
</span>
<div class="card-content-icon"><img class="card-content-icon-img" src="material-design-icons/painter14.png"></div>
<div class="card-content">
<h2></h2>
<p> Check it out! Right click > "Inspect Element"</p>
<h4>Learn More</h4>
</div>
</div> <!--End Card-->
<div class="card">
<span class="card-color" id="gamingthronebar">
<div class="card-icon"><img class="card-icon-img" src="material-design-icons/gamingthronewhite.png"></div>
<h1 class="card-color-title">Another cool project</h1>
</span>
<div class="card-content-icon"><img class="card-content-icon-img" src="material-design-icons/memory1.png"></div>
<div class="card-content">
<p>This is a test of the emergency broadcast system.</p>
<h4>This is a link</h4>
</div>
</div><!--End Card-->
<div class="card">
<span class="card-color">
<div class="card-icon"><img class="card-icon-img" src="material-design-icons/round58.png"></div>
<h1 class="card-color-title">About the designer</h1>
</span>
<div class="card-content-icon"><img class="card-content-icon-img" src="material-design-icons/create3.png"></div>
<div class="card-content">
<p>I'm no one of consequence. But if you must know, I like Material Design. This website is a work in progress, but it's my best shot.</p>
<h4>Professional Version</h4>
</div>
</div><!--End Card-->
</div><!--End card track-->
</body>
And this works to a great extent, but the height of the cards are determined by the card in the next column, which is close, but I want the cards to be determined by the height of the one above it.
body {
background-color: #f1f1f3;
margin:auto;
}
h1 {
color:white;
font-family:"Roboto";
font-weight:100;
font-size:36px;
}
h2 {
font-family:'Roboto';
font-weight:100;
font-size:30px;
color:#212121;
}
h4 {
font-family:'Roboto';
font-weight:400;
font-style: italic;
font-size:16px;
color: #727272;
border-top: 1px solid #727272;
padding-top: 4px;
}
p {
font-family:'roboto';
font-weight:400;
font-size:20px;
color:#727272;
}
.content-link {
color:#212121;
text-decoration: none;
font-weight:700;
}
.card-track {
width:100%;
height: auto;
position:relative;
text-align: center;
}
.card {
width: 466px;
margin: 15px;
background-color:white;
border-radius: 4px;
display:inline-flex;
text-align: left;
}
.card-color {
width:466px;
height: 96px;
background-color: #395a66;
position:absolute;
border-radius: 4px 4px 0px 0px;
}
.card-icon {
height: 46px;
width:46px;
margin: 25px;
float:left;
}
.card-icon-img {
max-height: 48px;
height: auto;
-webkit-filter: invert(100%);
}
.card-content-icon-img {
max-height: 50px;
height: auto;
-webkit-filter: opacity(55%);
}
.card-color-title {
margin:27px;
}
#gamingthronebar {
background-color:#FFC107;
}
#colorbar {
background-color:#673AB7;
}
.card-content {
padding:100px 30px 20px 60px;
}
.card-content-icon {
float:left;
width:60px;
height:60px;
margin:120px 0px 0px 24px;
}
<link href='http://fonts.googleapis.com/css?family=Roboto:400italic,100,700,400' rel='stylesheet' type='text/css'>
<body>
<div class="card-track">
<!-- Card
<div class="card">
<span class="card-color">
<div class="card-icon"><img class="card-icon-img" src=""></div>
<h1 class="card-color-title"></h1>
</span>
<div class="card-content-icon"><img class="card-content-icon-img" src=""></div>
<div class="card-content">
<p></p>
<h4></h4>
</div>
</div><!--End Card-->
<div class="card">
<span class="card-color">
<div class="card-icon"><img class="card-icon-img" src="material-design-icons/verification24.png"></div>
<h1 class="card-color-title">Hello, World!</h1>
</span>
<div class="card-content-icon"><img class="card-content-icon-img" src="material-design-icons/android11.png"></div>
<div class="card-content">
<p>Take a look around this site, it's designed based upon the glorious look and feel of <a class="content-link" href="http://www.google.com/design/spec/material-design/introduction.html">Material Design</a>, a visual scheme designed by Google for use with Android 5.0 Lollipop. </p>
</div>
</div><!--End Card-->
<div class="card">
<span class="card-color" id="colorbar">
<div class="card-icon"><img class="card-icon-img" src="material-design-icons/good4.png"></div>
<h1 class="card-color-title">No Java required</h1>
</span>
<div class="card-content-icon"><img class="card-content-icon-img" src="material-design-icons/painter14.png"></div>
<div class="card-content">
<h2></h2>
<p>There was lots of java involved in the making of this website, but there's none in this website. Check it out! Right click > "Inspect Element"</p>
<h4>Learn More</h4>
</div>
</div> <!--End Card-->
<div class="card">
<span class="card-color" id="gamingthronebar">
<div class="card-icon"><img class="card-icon-img" src="material-design-icons/gamingthronewhite.png"></div>
<h1 class="card-color-title">Another cool project</h1>
</span>
<div class="card-content-icon"><img class="card-content-icon-img" src="material-design-icons/memory1.png"></div>
<div class="card-content">
<p>This is a test of the emergency broadcast system.</p>
<h4>This is a link</h4>
</div>
</div><!--End Card-->
<div class="card">
<span class="card-color">
<div class="card-icon"><img class="card-icon-img" src="material-design-icons/round58.png"></div>
<h1 class="card-color-title">About the designer</h1>
</span>
<div class="card-content-icon"><img class="card-content-icon-img" src="material-design-icons/create3.png"></div>
<div class="card-content">
<p>I'm no one of consequence. But if you must know, I like Material Design. This website is a work in progress, but it's my best shot.</p>
<h4>Professional Version</h4>
</div>
</div><!--End Card-->
</div><!--End card track-->
</body>
Any thoughts? The website has more to it obviously, but that's the main thing I'm struggling with currently.

Resources