I'm using Owlcarousel 2 (ngx-owl-carousel-o) and work good till i have 4/5 box image, but if i receive only one item or two the box with the image come too big, how i can fix this problem?
attach the image where up you can see the box image as single item, too big,
and below you can see with 5 items the size it's ok.
example http://betoffice.it
click in the button ALL under search
My Scss file
.content-carousel
{
max-width: 85vw !important;
margin: 0 auto;
padding: 0 0 1.5rem;
&.category-na {
.owl-carousel .owl-item {
width: 100% !important;
}
}
.category-title {
display: flex;
justify-content: space-between;
align-items: center;
h2 {
padding-left: 10px;
text-transform: uppercase;
font-size: 16px;
}
a{
margin-right: 10px;
}
}
.single-item {
height: 100%;
display: flex;
flex-direction: column;
border: 1px solid #e4e4e4;
border-radius: 3px;
.box-img {
position: relative;
&::after {
content:'';
position: absolute;
#include bg-icon('play', center, contain, 'png');
width: 47px;
height: 47px;
transition: opacity .8s ease-in-out;
opacity: 0;
z-index: 10;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
&::before {
content:'';
position: absolute;
background-color: rgba(1,20,48,.5);
z-index: 9;
opacity: 0;
transition: opacity .7s ease-in-out;
width: 100%;
height: 100%;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
&:hover {
&::before {
opacity: 1;
border-top-right-radius: 3px;
border-top-left-radius: 3px;
}
&::after {
opacity: 1;
}
.date-start {
opacity: 0;
}
}
img {
border-top-right-radius: 3px;
border-top-left-radius: 3px;
}
}
.box-meeting-info {
display: flex;
flex-direction: column;
flex-grow: 1;
p{
color: #1a1a1a;
&:hover, &:focus {
color: #1a1a1a;
}
}
}
}
.owl-carousel {
.owl-item {
padding: 0 10px;
}
}
}
#include media-breakpoint-up(xxl){
.content-carousel {
padding: 0 3rem 1.5rem;
}
}
owl-carousel-o {
.single-item {
background-color: #fff;
border: 1px solid #ccc;
.box-meeting-info {
position: relative;
padding: 1em;
}
&:hover {
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
}
.owl-carousel {
.content-link-video {
text-decoration: none;
}
.owl-stage {
display: flex;
padding-bottom: 15px;
}
}
.owl-theme .owl-nav {
position: absolute;
top: 30%;
width: 100%;
display: none;
.owl-prev, .owl-next {
border: 1px solid #ccc;
background-color: #f0f0f0;
display: flex;
justify-content: center;
align-items: center;
width: 40px;
height: 40px;
border-radius: 1px;
&:hover {
background-color: #e0dede;
}
&::before {
content:'';
height: 12px;
width: 26px;
opacity: 0.5;
}
}
.owl-prev {
left: -50px;
position: absolute;
&::before {
#include bg-icon('arrow-left', center, contain, 'png');
}
}
.owl-next {
right: -50px;
position: absolute;
&::before{
#include bg-icon('arrow-right', center, contain, 'png');
}
}
}
#include media-breakpoint-up(xl) {
.owl-theme .owl-nav {
display: block;
}
}
}
Component.html
component.html
<div class="carousel-container">
<div class="content-carousel">
<div class="category-title">
<h2>Meetings</h2>
<!--<a *ngIf="item.children.length >= 10" (click)="seeAllData(item.title)" class="btn b-button" [textContent]="'View More'"></a>-->
</div>
<owl-carousel-o [options]="customOptions">
<ng-container *ngFor="let item of uniqueMeetings; let i = index">
<ng-template carouselSlide [id]="i">
<a class="content-link-video" (click)="navigateTo(item._source.session_WIPOs2tId)">
<div class="single-item">
<div class="box-img">
<img [lazyLoad]="item._source.session_thumbnail" [defaultImage]="defaultImage" alt=""/>
<div class="date-start">
<p>{{item._source.session_startDate | date:'dd MMM yyyy'}}<span class="separator-time"> - </span><span class="time-video">{{item._source.session_startDate | date:'H:mm:ss'}}</span></p>
</div>
</div>
<div class="box-meeting-info">
<div class="box-article">
<p class="name-product">{{item._source.session_name}}</p>
</div>
</div>
</div></a>
</ng-template>
</ng-container>
</owl-carousel-o>
</div>
</div>
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I had this piece of css/html code that shows 9 pictures. Some of the pictures might be rectangular, and i want them to be displayed in squares like other pictures. What css rules do i need to adjust? The structure of html is in the picture, so is the current css rules.
I had this piece of css/html code that shows 9 pictures. Some of the pictures might be rectangular, and i want them to be displayed in squares like other pictures. What css rules do i need to adjust? The structure of html is in the picture, so is the current css rules.
I had this piece of css/html code that shows 9 pictures. Some of the pictures might be rectangular, and i want them to be displayed in squares like other pictures. What css rules do i need to adjust? The structure of html is in the picture, so is the current css rules.
The code is attached below
#import url("https://fonts.googleapis.com/css?family=Montserrat");
#import url("https://fonts.googleapis.com/css?family=Open+Sans");
body, html {
width: 100%;
height: 100%;
font-family: "Montserrat";
color: #303633;
background-color: #C8D9E7;
overflow: hidden;
font-size: 1em;
font-style: normal;
-webkit-appearance: none;
outline: none;
text-rendering: geometricPrecision;
perspective: 1000px;
}
a {
position: relative;
display: inline-block;
padding: 12px 35px;
margin: 0 0 20px;
background-color: #e1306c;
color: white;
border-radius: 5px;
transition: all 0.3s;
letter-spacing: 2px;
font-size: 0.85em;
font-weight: 700;
text-decoration: none;
text-transform: uppercase;
box-shadow: 0 2px 30px rgba(225, 48, 108, 0.4);
}
a:hover {
background-color: #e75d8c;
}
.content-wrapper {
width: 300px;
max-height: 530px;
border-radius: 5px;
box-shadow: 0 2px 30px rgba(0, 0, 0, 0.2);
background: #fbfcee;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
overflow-y: scroll;
overflow-x: hidden;
text-align: center;
}
.content-wrapper::-webkit-scrollbar {
display: none;
}
.content-wrapper .img {
width: 302px;
height: 350px;
position: relative;
overflow: hidden;
}
.content-wrapper .img::after {
content: "";
display: block;
position: absolute;
top: 0;
width: 100%;
height: 100%;
background: linear-gradient(to top, rgba(88, 81, 219, 0.25), transparent);
}
.content-wrapper img {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
object-fit: contain;
}
.profile--info {
text-align: left;
padding-top: 10px;
}
.profile--info span {
font-family: "Open Sans", "Adobe Blank";
z-index: 1;
left: 15px;
top: 15px;
font-size: 0.575em;
color: rgba(84, 95, 89, 0.75);
display: block;
}
.profile--info span.username {
font-weight: 700;
font-style: normal;
font-size: 1em;
color: black;
}
.profile--info span.userquote {
margin-top: -15px;
font-size: 0.7em;
color: rgba(84, 95, 89, 0.75);
}
.user {
background-color: white;
width: 100%;
margin-top: 0;
max-height: 600px;
position: relative;
padding: 0 30px;
box-sizing: border-box;
}
.user-social-wrapper {
display: flex;
justify-content: space-around;
position: relative;
padding: 5px 0;
padding-bottom: 15px;
}
.user-social-wrapper::after, .user-social-wrapper::before {
content: "";
display: block;
position: absolute;
top: 0;
width: 100%;
height: 1px;
}
.user-social-wrapper::before {
top: initial;
bottom: 0;
}
.user-social-wrapper .user-info {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-weight: 200;
flex: 1 1;
}
.user-social-wrapper .user-info span:first-child {
font-size: 1.25em;
}
.user-social-wrapper .user-info span:last-child {
font-size: 0.75em;
color: rgba(84, 95, 89, 0.75);
}
.shots {
width: calc(100% + 60px);
margin-left: -30px;
position: relative;
display: flex;
flex-wrap: wrap;
}
.shots .shot {
overflow: hidden;
position: relative;
width: 100px;
height: 100px;
}
.shots .shot::after {
content: "";
display: block;
opacity: 0;
transition: all 0.255s;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
}
.shots .shot img {
transition: all 0.255s;
width: 102px;
}
#keyframes drift {
from {
transform: rotate(0deg);
}
from {
transform: rotate(360deg);
}
}
<div class="content-wrapper">
<div class="user">
<div class="shots">
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/c2daebf39514481b7bdd696df185794a/5CB41E95/t51.2885-15/e35/44305549_353634695394272_4379074065337998962_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkxMjA0MDQ0OTAyMTY1Njc4Mg%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/c079f9938e0004cd465e9b3a23823638/5CB841C6/t51.2885-15/e35/41336764_2309590515939856_3014107714986624367_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg3Nzg1Mjk1Njk0NDkwNTAwMg%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/4c03bcf4125a52da4db64348fded2e64/5CD059B2/t51.2885-15/e35/46699770_789255231412285_7247415646102729111_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkyMjcyMTIwOTQyODk0Mjc5NQ%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/2ddf693641bf3e4dad7f0e4113196ed3/5C9D1D98/t51.2885-15/e35/42593422_668756993510074_548785136612309253_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg4MjI5MDk5MzYyODEwOTk0Mw%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/293669652704407f1519034a237110fc/5CD53EA6/t51.2885-15/e35/44442144_2039456152959656_8454847146314760657_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkxMTEwMTUwMTEzOTEzMzk4MA%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/0a8c6666eeaace1c7eff30c25aa672c6/5CD46203/t51.2885-15/e35/43816352_986229031581012_2433270463824730761_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg5NTQwODg2MDE5NjA5OTA1NQ%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/7841eff64f571f60c9ec1d169158851e/5C9BD445/t51.2885-15/e35/43621864_2280294755587222_1177965970195440793_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg4NjY0MTkwODQ0MTE4MDcyOQ%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/a78a72efb59d50ceeae8e6bcbaa82f92/5CCFD742/t51.2885-15/e35/42927631_265838184102659_8658034749053379565_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkxNjkzMDk2MDM3NTMwNTUzOA%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/77a032f68b948ae7049ea644777fc393/5CB3E901/t51.2885-15/e35/41866047_1814622118587789_2219135764187038727_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg4NDI5OTEwNzU1ODU4OTEzMg%3D%3D.2"></div>
</div>
<div class="profile--info"><span class="username">ʏɪɴʀᴜɪ ᴅᴇɴɢ</span><span>☺#bobby_dyr</span><br><span class="userquote">In 2018, ʏɪɴʀᴜɪ ᴅᴇɴɢ received 164❤️, 7✉️ per post by average, and a total of</span></div>
<div class="user-social-wrapper">
<div class="user-info user-posts"><span>104</span><span>Shots</span></div>
<div class="user-info user-followers"><span>16,963</span><span>Likes</span></div>
<div class="user-info user-following"><span>643</span><span>Comments</span></div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://use.fontawesome.com/f09496b7cc.js"></script>
<script src="js/index.js"></script>
</div>
The following styles are enough to make your images fit:
.content-wrapper img {
width: 100%;
height: 100%;
object-fit: cover;
}
Don't forget to set height and width to 100%.
#import url("https://fonts.googleapis.com/css?family=Montserrat");
#import url("https://fonts.googleapis.com/css?family=Open+Sans");
body, html {
width: 100%;
height: 100%;
font-family: "Montserrat";
color: #303633;
background-color: #C8D9E7;
overflow: hidden;
font-size: 1em;
font-style: normal;
-webkit-appearance: none;
outline: none;
text-rendering: geometricPrecision;
perspective: 1000px;
}
a {
position: relative;
display: inline-block;
padding: 12px 35px;
margin: 0 0 20px;
background-color: #e1306c;
color: white;
border-radius: 5px;
transition: all 0.3s;
letter-spacing: 2px;
font-size: 0.85em;
font-weight: 700;
text-decoration: none;
text-transform: uppercase;
box-shadow: 0 2px 30px rgba(225, 48, 108, 0.4);
}
a:hover {
background-color: #e75d8c;
}
.content-wrapper {
width: 300px;
max-height: 530px;
border-radius: 5px;
box-shadow: 0 2px 30px rgba(0, 0, 0, 0.2);
background: #fbfcee;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
overflow-y: scroll;
overflow-x: hidden;
text-align: center;
}
.content-wrapper::-webkit-scrollbar {
display: none;
}
.content-wrapper .img {
width: 302px;
height: 350px;
position: relative;
overflow: hidden;
}
.content-wrapper .img::after {
content: "";
display: block;
position: absolute;
top: 0;
width: 100%;
height: 100%;
background: linear-gradient(to top, rgba(88, 81, 219, 0.25), transparent);
}
.content-wrapper img {
/*
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
object-fit: contain;
*/
width: 100%;
height: 100%;
object-fit: cover;
}
.profile--info {
text-align: left;
padding-top: 10px;
}
.profile--info span {
font-family: "Open Sans", "Adobe Blank";
z-index: 1;
left: 15px;
top: 15px;
font-size: 0.575em;
color: rgba(84, 95, 89, 0.75);
display: block;
}
.profile--info span.username {
font-weight: 700;
font-style: normal;
font-size: 1em;
color: black;
}
.profile--info span.userquote {
margin-top: -15px;
font-size: 0.7em;
color: rgba(84, 95, 89, 0.75);
}
.user {
background-color: white;
width: 100%;
margin-top: 0;
max-height: 600px;
position: relative;
padding: 0 30px;
box-sizing: border-box;
}
.user-social-wrapper {
display: flex;
justify-content: space-around;
position: relative;
padding: 5px 0;
padding-bottom: 15px;
}
.user-social-wrapper::after, .user-social-wrapper::before {
content: "";
display: block;
position: absolute;
top: 0;
width: 100%;
height: 1px;
}
.user-social-wrapper::before {
top: initial;
bottom: 0;
}
.user-social-wrapper .user-info {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-weight: 200;
flex: 1 1;
}
.user-social-wrapper .user-info span:first-child {
font-size: 1.25em;
}
.user-social-wrapper .user-info span:last-child {
font-size: 0.75em;
color: rgba(84, 95, 89, 0.75);
}
.shots {
width: calc(100% + 60px);
margin-left: -30px;
position: relative;
display: flex;
flex-wrap: wrap;
}
.shots .shot {
overflow: hidden;
position: relative;
width: 100px;
height: 100px;
}
.shots .shot::after {
content: "";
display: block;
opacity: 0;
transition: all 0.255s;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
}
.shots .shot img {
transition: all 0.255s;
width: 102px;
}
#keyframes drift {
from {
transform: rotate(0deg);
}
from {
transform: rotate(360deg);
}
}
<div class="content-wrapper">
<div class="user">
<div class="shots">
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/c2daebf39514481b7bdd696df185794a/5CB41E95/t51.2885-15/e35/44305549_353634695394272_4379074065337998962_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkxMjA0MDQ0OTAyMTY1Njc4Mg%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/c079f9938e0004cd465e9b3a23823638/5CB841C6/t51.2885-15/e35/41336764_2309590515939856_3014107714986624367_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg3Nzg1Mjk1Njk0NDkwNTAwMg%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/4c03bcf4125a52da4db64348fded2e64/5CD059B2/t51.2885-15/e35/46699770_789255231412285_7247415646102729111_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkyMjcyMTIwOTQyODk0Mjc5NQ%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/2ddf693641bf3e4dad7f0e4113196ed3/5C9D1D98/t51.2885-15/e35/42593422_668756993510074_548785136612309253_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg4MjI5MDk5MzYyODEwOTk0Mw%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/293669652704407f1519034a237110fc/5CD53EA6/t51.2885-15/e35/44442144_2039456152959656_8454847146314760657_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkxMTEwMTUwMTEzOTEzMzk4MA%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/0a8c6666eeaace1c7eff30c25aa672c6/5CD46203/t51.2885-15/e35/43816352_986229031581012_2433270463824730761_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg5NTQwODg2MDE5NjA5OTA1NQ%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/7841eff64f571f60c9ec1d169158851e/5C9BD445/t51.2885-15/e35/43621864_2280294755587222_1177965970195440793_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg4NjY0MTkwODQ0MTE4MDcyOQ%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/a78a72efb59d50ceeae8e6bcbaa82f92/5CCFD742/t51.2885-15/e35/42927631_265838184102659_8658034749053379565_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkxNjkzMDk2MDM3NTMwNTUzOA%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/77a032f68b948ae7049ea644777fc393/5CB3E901/t51.2885-15/e35/41866047_1814622118587789_2219135764187038727_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg4NDI5OTEwNzU1ODU4OTEzMg%3D%3D.2"></div>
</div>
<div class="profile--info"><span class="username">ʏɪɴʀᴜɪ ᴅᴇɴɢ</span><span>☺#bobby_dyr</span><br><span class="userquote">In 2018, ʏɪɴʀᴜɪ ᴅᴇɴɢ received 164❤️, 7✉️ per post by average, and a total of</span></div>
<div class="user-social-wrapper">
<div class="user-info user-posts"><span>104</span><span>Shots</span></div>
<div class="user-info user-followers"><span>16,963</span><span>Likes</span></div>
<div class="user-info user-following"><span>643</span><span>Comments</span></div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://use.fontawesome.com/f09496b7cc.js"></script>
<script src="js/index.js"></script>
</div>
object-fit: contain;
to
object-fit: cover;
So I am trying to do conditional rendering and i've narrowed it down to the outside parent <div> tag being the culprit. So, I removed the conditional rendering and am trying to figure out why my card styling is being altered. Below I posted screenshots with and without parent div tag.
return (
<div>
<div className="card" id="chatcard">
<div className="card-body">
<h5 className="card-title">{this.props.user.user}</h5>
<div className="card-text">
<ChatList
user={this.props.user}
socket={this.props.socket}
currentUser={this.props.currentUser}
/>
</div>
</div>
<div className="card-footer">
<small className="text-muted">
<form>
<ChatField
user={this.props.user}
socket={this.props.socket}
chatusers={this.props.index}
/>
</form>
</small>
</div>
</div>
</div>
);
CSS
.chat {
color: white;
}
.chat .dropdown-toggle:after {
content: none;
}
.userbutton {
size: 2px;
}
.card {
color: black;
}
.card-text {
overflow: auto;
height: 10rem;
}
.onlinebar {
position: "absolute";
color: red;
bottom: 0;
left: 0;
}
#chatbtn {
color: black;
width: 200px;
margin-left: 5px;
margin-top: 0px;
}
.chatcollapse {
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
}
#chatHeader {
margin: 0px;
padding: 0px;
}
#chatcard {
width: 2rem;
}
.card-deck .card {
max-width: calc(25% + 80px);
}
.card-body {
padding: 0px;
margin: 0px;
}
.bubble-r {
align-items: flex-end;
position: relative;
background: #0072c6;
max-width: 100px;
padding: 5px;
font-family: arial;
margin: 0 auto;
font-size: 14px;
color: white;
border-radius: 6px;
}
.bubble-r:after,
.bubble-r:before {
left: 100%; /*change this from right to left*/
top: 42%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.bubble-r:after {
border-color: rgba(200, 200, 204, 0);
border-left-color: #0072c6; /*change this from right to left */
border-width: 8px;
margin-top: -3px;
}
.bubble-r:before {
border-color: rgba(200, 204, 0, 0);
border-left-color: #0072c6; /*change this from right to left*/
border-width: 8px;
margin-top: -3px;
}
.bubble {
position: relative;
background: #cad5d7;
max-width: 100px;
padding: 5px;
font-family: arial;
margin: 0 auto;
font-size: 14px;
border-radius: 6px;
}
.bubble:after,
.bubble:before {
right: 100%;
top: 42%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.bubble:after {
border-color: rgba(255, 255, 204, 0);
border-right-color: #cad5d7;
border-width: 8px;
margin-top: -3px;
}
.bubble:before {
border-color: rgba(255, 204, 0, 0);
border-right-color: #cad5d7;
border-width: 8px;
margin-top: -3px;
}
#chatcard {
width: 40rem;
}
I adjusted the width within this and it worked. It's odd that adding the div tag caused this.
See this image
Facebook Messenger Android App Buttons ( MESSENGER\ACTIVE )
How can i achieve this ?
in details :-
A div with 2px red border.
that div contains 2 buttons with inline block.
one is on left side and other one is at right side of DIV.
LIKE : [BUTTON1][BUTTON2]
but i want this :- [BUTTON1\BUTTON2]
a Slash style shape between both buttons.
i have tried
#M_Left {
width: 0;
height: 0;
margin: 0 !important;
padding: 0 !important;
display: inline-block;
border-top: 100px solid #3fc2ff;
border-right: 50px solid transparent;
border-left: 400px solid #3fc2ff;
color: #fff;
text-align: center;
}
#M_Right {
width: 0;
height: 0;
margin-left: -40;
border-bottom: 100px solid #3fc2ff;
display: inline-block;
border-right: 400px solid #3fc2ff;
border-left: 50px solid transparent;
color: #fff;
text-align: center !important;
}
.white_M {
margin: 0 !important;
padding: 0 !important;
height: 0 !important;
display: inline-block;
min-width: 400px;
border-width: 0 !important;
border-style: none !important;
color: #3fc2ff !important;
}
.M_Container {
margin: 0 !important;
padding: 0 !important;
width: auto !important;
display: inline-block;
border: 2px solid #3fc2ff;
}
<div class="M_Container">
<div id="M_Left"> HEY</div>
<div id="M_Right" class="white_Mx"> </div>
</div>
Please help me
Thank you in advance
You can create it by using following approach
$('button').click(function() {
$(this).addClass('current').siblings().removeClass('current');
});
.buttonGroup {
display: flex;
border: 1px solid skyblue;
/* Border color change as your need */
overflow: hidden;
border-radius: 5px;
max-width: 350px;
}
button {
flex: 1;
background: none;
border: none;
outline: none;
padding: 5px;
cursor: pointer;
position: relative;
}
button:hover:before {
background: skyblue;
}
button:hover:after {
background: skyblue;
}
button.current:before {
background: skyblue;
}
button.current:after {
background: skyblue;
}
button:before {
content: '';
width: 100%;
height: 100%;
background: #fff;
position: absolute;
transform: skewX(-25deg);
left: -5px;
top: 0;
z-index: -1;
}
button:after {
content: '';
width: 100%;
height: 100%;
background: #fff;
position: absolute;
transform: skewX(-25deg);
right: -5px;
top: 0;
z-index: -1;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="buttonGroup">
<button>Hello</button>
<button>Bye</button>
</div>
Try this.
$('button').click(function() {
$('button').removeClass('active');
$(this).addClass('active');
})
.wrap {
white-space: nowrap;
font-size: 0;
border: 2px solid navy;
display: inline-block;
overflow: hidden;
}
button {
border: 0;
background: #fff;
padding: 10px 20px;
position: relative;
outline: 0;
cursor:pointer;
}
button:after,
button:before {
content: '';
position: absolute;
transform: skewX(-25deg);
height: 100%;
width: 10px;
background: #fff;
top: 0;
z-index: 1;
right: 0;
}
button:before {
right: auto;
left: 0;
}
button.active {
background: blue;
color: #fff;
}
button.active:after,
button.active:before {
background: blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="wrap">
<button>Button</button>
<button class="active">Active</button>
</div>
I am almost finish with building the skeleton of my simon game clone and the only left I want to do is set the container (which holds the game itself) to have a max height of 605px.
I was able to accomplish its width max when it reaches a certain threshold in the viewport but I am having hard time applying the same behavior but horizontally instead.
Any inputs will be greatly appreciated.
I've attached my code in CodePen as well:
http://codepen.io/neotriz/pen/RRxOJb
body {
background: skyblue;
font-family: 'Righteous', cursive;
box-sizing: border-box; }
.container {
width: 100%;
display: flex;
flex-wrap: wrap; }
.game {
display: flex;
flex-wrap: wrap;
width: 100%;
height: 70vh;
margin-top: 10px; }
.button {
position: relative;
display: block;
height: 50%;
width: 50%;
margin-bottom: 1px; }
#green {
background: #39d565;
border-top-left-radius: 25%;
box-shadow: 0 6px 0 #0d934b;
bottom: 6px;
transition: all 0.1s linear; }
#green:active {
bottom: 0px;
box-shadow: 0px 0px 0px #0d934b; }
#red {
background: #d23a51;
border-top-right-radius: 25%;
box-shadow: 0 6px 0 #711515;
bottom: 6px;
transition: all 0.1s linear; }
#red:active {
bottom: 0px;
box-shadow: 0px 0px 0px #711515; }
#blue {
background: #09f;
border-bottom-left-radius: 25%;
box-shadow: 0 6px 0 #06c;
bottom: 6px;
transition: all 0.1s linear; }
#blue:active {
bottom: 0px;
box-shadow: 0px 0px 0px #06c; }
#yellow {
background: #FD9A01;
border-bottom-right-radius: 25%;
box-shadow: 0 6px 0 #916828;
bottom: 6px;
transition: all 0.1s linear; }
#yellow:active {
bottom: 0px;
box-shadow: 0px 0px 0px #916828; }
.score {
width: 100%;
height: 10vh;
text-align: center;
color: #FFF;
text-shadow: 1px 3px 2px black;
margin-bottom: 5px; }
.control-panel {
text-align: center;
width: 100%;
display: flex;
flex-wrap: wrap;
position: relative;
height: 15vh;
align-items: center;
justify-content: center;
background: #aaaaaa;
border-radius: 10px; }
.control-panel #on-off-btn {
width: 33.3333%; }
.control-panel #level {
width: 33.3333%; }
.control-panel #start {
width: 33.3333%; }
.control-panel p {
margin: 8px 0px 0px 0px; }
.cmn-toggle {
position: absolute;
margin-left: -9999px;
visibility: hidden; }
.cmn-toggle + label {
display: block;
position: relative;
cursor: pointer;
outline: none;
user-select: none; }
input.cmn-toggle-round + label {
padding: 2px;
max-width: 90%;
height: 35px;
background-color: #dddddd;
border-radius: 60px;
margin-top: 9px;
margin-left: 5px; }
input.cmn-toggle-round + label:before,
input.cmn-toggle-round + label:after {
display: block;
position: absolute;
top: 1px;
left: 1px;
bottom: 1px;
content: ""; }
input.cmn-toggle-round + label:before {
right: 1px;
background-color: white;
border-radius: 60px;
transition: background 0.4s; }
input.cmn-toggle-round + label:after {
width: 38px;
background-color: #fff;
border-radius: 100%;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
transition: margin-left 0.4s; }
input.cmn-toggle-round:checked + label:before {
background-color: #8ce196; }
input.cmn-toggle-round:checked + label:after {
margin-left: 58%; }
.btn-round {
width: 50%;
height: 50px;
background: #ed2914;
border-radius: 100%;
outline: none;
box-shadow: 0 6px 0 #711515;
bottom: 6px;
transition: all 0.1s linear; }
.btn-round:active {
bottom: 0px;
box-shadow: 0px 0px 0px #711515; }
#media screen and (max-width: 311px) {
input.cmn-toggle-round:checked + label:after {
margin-left: 45%; } }
#media screen and (min-width: 426px) {
.container {
width: 426px;
margin-left: auto;
margin-right: auto; }
input.cmn-toggle-round:checked + label:after {
margin-left: 66%; } }
#media screen and (min-height: 605px) {
.container {
height: 605px; } }
<!DOCTYPE html>
<html lang="en">
<head>
<title>Simon Game FCC</title>
</head>
<body>
<div class="container">
<div class="game">
<div id="green" class="button"></div>
<div id="red" class="button"></div>
<div id="blue" class="button"></div>
<div id="yellow" class="button"></div>
</div>
<div class="score">
<h2>Score: 0 </h2>
</div>
<div class="control-panel">
<div id="on-off-btn">
<input id="on-off-slider"type="checkbox" class="cmn-toggle cmn-toggle-round">
<label for="on-off-slider"></label>
<p>Off/On</p>
</div>
<div id="level">
<input id="level-slider"type="checkbox" class="cmn-toggle cmn-toggle-round">
<label for="level-slider"></label>
<p>Level</p>
</div>
<div id="start">
<button class="btn-round"></button>
<p>(re)Start</p>
</div>
</div>
</div>
</body>
</html>
I think mixing vh heights and flex disposition is part of the problem because it makes the code a bit tricky to adjust. So I would suggest to remove all vh heights that are inside the container and replace them with a flex vertical positionning.
Here is the sccs I get (only the changed rules are here) :
.container {
width: 100%;
display: flex;
flex-wrap: wrap;
height: 100vh;
flex-direction: column;
justify-content: center; }
.game {
display: flex;
flex-wrap: wrap;
width: 100%;
margin-top: 10px;
flex: 1 1 auto; }
.score {
width: 100%;
text-align: center;
color: #FFF;
text-shadow: 1px 3px 2px black;
margin-bottom: 5px;
flex: 0 0 auto; }
.control-panel {
text-align: center;
width: 100%;
display: flex;
flex-wrap: wrap;
position: relative;
align-items: center;
justify-content: center;
background: #aaaaaa;
border-radius: 10px;
flex: 0 0 auto; }