I have 2 div's #propuesta and .dropdown, I want to appear one and disappear the another one when I change the resolution with display: none and display: block properties, but it wont work. Here is my code
<div class="propuestas">
<div class="square"><img src="img/fa-building.png" title="Infraestructura"></div>
<div class="square"><img src="img/fa-car.png" title="Movilidad"></div>
<div class="square"><img src="img/fa-education.png" title="Educacion"></div>
<div class="square"><img src="img/fa-firstaid.png" title="Salud"></div>
<div class="square"><img src="img/fa-police.png" title="Seguridad"></div>
<div class="square"><img src="img/fa-public.png" title="Espacio Publico"></div>
<div class="square"><img src="img/fa-teamwork.png" title="Trabajo en equipo"></div>
<div class="square"><img src="img/fa-tics.png" title="Técnologia"></div>
<div class="square"><img src="img/fa-water.png" title="Servicios Públos"></div>
<div class="square"><img src="img/fa-woman.png" title="Mujer"></div>
<div class="square"><img src="img/fa-worker.png" title="Empleo"></div>
</div>
<!--MENU PROPUESTAS RESPONSIVE-->
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Categorias</button>
<div id="myDropdown" class="dropdown-content">
Infraestructura y medio ambiente
Empleo
Educación
Trabajo en equipo
Servicios Públicos
Movilidad
Seguridad
Social
Mujer
Tecnologia
</div>
</div>
.propuestas{
width: 100%;
height: 95%;
background-color: rgb(66, 35, 10);
display: flex;
flex-flow: wrap;
justify-content: center;
}
.dropdown {
width: 100%;
height: auto;
position: relative;
display: none;
cursor: pointer;
}
/* media queries*/
#media only screen and (max-width: 2048px) {
.dropdown{
display:none;
}
#propuestas{
display: block;
}
}
#media only screen and (max-width: 748px) {
.dropdown{
display: block ;
}
#propuestas{
display: none;
}
}
you can see the result in following link.
https://jsfiddle.net/ciscojuan/4zqu80av/1/
Your #propuestas css selector in the media query is for an ID.
For class, it should be written as .propuestas.
Related
I am working on a site for a school project where I have 2 media query breakpoints cascading down from desktop to tablet and finally to mobile. My tablet breakpoint at 991px is working fine, but my mobile breakpoint at 479px does not register any changes at all. And I really have no idea what is wrong.
I tried to make more than one breakpoint for my website using media query, expecting it to work right away. The result show that only the media query with the highest max-width value works.
Any help is much appreciated.
This is how I have been writing my media queries:
#media only screen and (max-width: 991px) {}
#media only screen and (max-width: 479px) {}
This is all the code that I have been writing for my media queries if needed
#media only screen and (max-width: 991px) {
body {
width: 96%;
}
h2 {
font-family: 'salomeitalic';
font-weight: normal;
font-style: normal;
font-size: clamp(50px, 5.208vw, 100px);
padding: 0px;
margin: 0px;
line-height: 1.1;
color: #242325;
}
.p2 {
font-family: 'Satoshi-Variable';
font-weight: medium;
font-size: clamp(16px, 1.094vw, 21px);
color: #242325;
margin: 0;
}
.nav-front {
position: sticky;
right: auto;
top: auto;
bottom: auto;
display: flex;
flex-direction: row;
justify-content: space-between;
width: 100%;
height: 100%;
border-left: none;
padding: clamp(20px, 2.083vw, 40px);
}
.top-wrapper {
display: flex;
justify-content: space-between;
width: 100%;
}
.nav-links {
display: flex;
flex-direction: row;
background-color: #242325;
border-radius: 50px;
}
.nav-logo {
height: 70px;
width: auto;
margin-bottom: 0;
}
.nav-top {
display: none;
margin-bottom: 40px;
}
a {
font-family: 'Satoshi-Variable';
font-weight: medium;
font-size: clamp(18px, 1.302vw, 25px);
color: #FFF8F2;
margin-bottom: 0;
text-decoration: none;
background-color: #242325;
padding: 20px;
border-radius: 50px;
}
.contact-wrapper {
display: none;
}
header {
width: 100%;
height: 80vh;
}
.profile-img-wrapper {
width: 90%;
}
.about-wrapper {
width: 95%;
}
.scroll-button-wrapper {
display: flex;
justify-content: end;
width: 104%
}
main {
width: 100%;
}
.project-1 {
height: 455px;
}
.project-3 {
height: 455px;
}
.project-5 {
height: 455px;
}
.contact-div {
height: 435px;
}
.arrow-up-left {
margin-bottom: 17%;
}
}
#media (max-width: 479px) {
body {
background-color: aqua;
}
h2 {
font-family: 'salomeitalic';
font-weight: normal;
font-style: normal;
font-size: clamp(50px, 13.021vw, 250px);
padding: 0px;
margin: 0px;
line-height: 1.1;
color: #242325;
}
header {
display: flex;
flex-direction: column;
height: 100%
}
.header-left {
width: 100%;
height: 100vh;
}
}
<html lang="da" dir="ltr">
<head>
<meta charset="UTF-8">
<title>HTML CODE</title>
<link rel="stylesheet" href="projekt-3.css">
</head>
<body>
<nav class="nav-front">
<div class="top-wrapper">
<img class="nav-logo"
src="exports/logo.svg" alt="Staugaard Design Logo">
<div class="nav-links">
<div class="nav-top">
<p>navigation</p>
<img class="arrow-down" src="exports/arrow-down.svg">
</div>
om mig
projekter
kontakt
</div>
</div>
<div class="contact-wrapper">
<div class="margin-buttom">
instagram
</div>
<p>©2022</p>
<button>KONTAKT</button>
</div>
</nav>
<header>
<div class="header-left">
<div class="margin">
<h2>KREATIV DESIGNER & UDVIKLER</h2>
</div>
<div class="moving-text-wrapper">
<img class='orange-star' src="exports/star-orange.svg">
<p class="white">2022 PORTFOLIO</p>
<img class='orange-star' src="exports/star-orange.svg">
<p class="white">2022 PORTFOLIO</p>
<img class='orange-star' src="exports/star-orange.svg">
</div>
<div class="profile-img-wrapper">
</div>
</div>
<div class="header-right">
<div class="about-wrapper">
<img class="black-star" src="exports/star-2.svg">
<p>hej! mit navn er kristoffer. jeg er en freelance web designer samt web udvikler som bor i odense. Jeg skaber smukke hjemmesider i samarbejde med virksomheder og selvstændige som gerne vil skille sig ud fra konkurrenterne.</p>
</div>
<div class="scroll-button-wrapper">
<div class="scroll-button">
<img class="orange-arrow" src="exports/orange-arrow.svg">
</div>
</div>
</div>
</header>
<div class="transition">
<h1>UDVALGTE<br>PROJEKTER</h1>
</div>
<main>
<div class="main">
<div class="project-1">
<div class="project-text1">
<div class="margin-buttom">
<h2>classic curry</h2>
</div>
<p class="p2">restauranten classic curry er en klassisk indisk restaurant som laver autentiske retter. projekt gik ud på at vi skulle vælge en hjemmeside som vi synes manglede en kærlig hånd.</p>
</div>
<div class="project-visual">
<div class="img-wrapper">
<img class="project-img" src="exports/classic-img.png" alt="classic curry hjemmeside">
</div>
<img class="arrow-up-left" src="exports/arrow-up.svg" alt="knap til at se hjemmesiden">
</div>
</div>
<div class="project-2">
<div class="project-text2">
<div class="margin-buttom">
<h2>gluds</h2>
</div>
<p class="p2">gluds café manglede en hjemmeside som kunne fremvise alt hvad caféen har at byde på, i et elegant design.</p>
</div>
<div class="project-visual">
<img class="arrow-up-right" src="exports/arrow-up.svg" alt="knap til at se hjemmesiden">
<img class="project-img" src="exports/gluds-img.png" alt="gluds cafe hjemmeside">
</div>
</div>
</div>
<div class="main">
<div class="contact-div">
<img class="arrow-up-white" src="exports/arrow-up-white.svg">
<div class="contact-text">
<h3>kontakt<br>kontakt<br>kontakt</h3>
</div>
</div>
<div class="project-3">
<div class="project-text3">
<div class="margin-buttom">
<h2>justesen artpack</h2>
</div>
<p class="p2">virksomheden justesen artpack er et kunst transport- og vedligeholdelses firma. De havde brug for en mere advanceret hjemmeside og et mere moderne design, som de selv kunne opdatere med blog indlæg.</p>
</div>
<div class="project-visual">
<div class="img-wrapper">
<img class="project-img" src="exports/justesen-img.png" alt="justesen artpacks hjemmeside">
</div>
<img class="arrow-up-left2" src="exports/arrow-up.svg" alt="knap til at se hjemmesiden">
</div>
</div>
</div>
<div class="main">
<div class="project-4">
<div class="project-text4">
<div class="margin-buttom">
<h2>m/k aps</h2>
</div>
<p class="p2">m/k service aps er et rengørings firma som manglede et nyere og moderne design, med mere funktionalitet.</p>
</div>
<div class="project-visual">
<img class="arrow-up-right" src="exports/arrow-up.svg" alt="knap til at se hjemmesiden">
<img class="project-img" src="exports/mk-img.png" alt="mk serverice hjemmeside">
</div>
</div>
<div class="project-5">
<div class="project-text5">
<div class="margin-buttom">
<h2>by gitte lage</h2>
</div>
<p class="p2">wellness -by gitte lage er en virksomhed som tilbyder wellness behandlinger og massager. i et tæt samarbejde med ejeren hjalp jeg med at bygge virksomhedens online struktur fra bunden.</p>
</div>
<div class="project-visual">
<div class="img-wrapper">
<img class="project-img" src="exports/wellness-img.png" alt="mk serverice hjemmeside">
</div>
<img class="arrow-up-left" src="exports/arrow-up.svg" alt="knap til at se hjemmesiden">
</div>
</div>
</div>
</main>
</body>
Please try to keep the mobile screen media query above the tablet media query code once
I am currently working on a forum project, and had some problems with the CSS styling.
I am trying to position text into a HTML button, I managed to position one part of the text correctly, but the other part can't be positioned as the first, even if the CSS and HTML code is the same.
I tried wrapping the elements in a div, and somehow, I never manage to get them displayed into the button, even with margin-bottom.
Here the HTML Code:
<button>
<div class="forum-list-header">
<div class="forum-list-border"><i class="fa-solid fa-laptop-code fa-2xl"></i></div>
<h2>Tech, Informatique et autres</h2>
</div>
<div class="forum-list-info">
<h3>5.1k</h3><h3>50.3k</h3>
<p>Posts</p><p>Messages</p>
</div>
</button>
Here is the CSS code:
.forum-container { /* This is wrapped around the button elements */
position:absolute;
left:18%;
margin-top:42em;
font-family: Poppins-SemiBold, FontAwesome;
}
.forum-list-container { /* This is wrapped around the button elements */
margin-top:3em;
}
.forum-list button {
background-color: #172129;
border: 2px solid #212e38;
border-radius: 10px;
padding: 10px 40px;
width:80em;
height: 10em;
font-family: Poppins-SemiBold, FontAwesome;
color:white;
margin-right: 1em;
display:block;
margin-bottom: 2em;
}
.forum-list-header { /* Text aligned left, perfectly placed, won't work with the other text */
display:flex;
align-items:center;
}
.forum-list h2 {
margin-left:2em;
}
.forum-list .forum-list.btn {
margin-bottom:2em;
}
.forum-list-info {
/* Here should be the code to position it. */
}
.forum-list-info {
display: flex;
align-items: center;
justify-content: space-around;
}
//add this style to your css
<button>
<div class="forum-list-header">
<div class="forum-list-border"><i class="fa-solid fa-laptop-code fa-2xl"></i></div>
<h2>Tech, Informatique et autres</h2>
</div>
<div class="forum-list-info">
<div>
<h3>5.1k</h3>
<p>Posts</p>
</div>
<div>
<h3>50.3k</h3>
<p>Messages</p>
</div>
</div>
</button>
//and replace this html code. you can get what you want.
Should make each of those its own div, then style that div.
<button>
<div class="forum-list-header">
<div class="forum-list-border"><i class="fa-solid fa-laptop-code fa-2xl"></i></div>
<h2>Tech, Informatique et autres</h2>
</div>
<div class="forum-list-info">
<div><h3>5.1k</h3><p>Posts</p></div>
<div><h3>50.3k</h3><p>Messages</p></div>
</div>
</button>
Fix for this:
I edited my CSS classes to:
.forum-list-info {
grid-column-start: 2;
grid-column-end: 3;
margin-left: 17em;
}
.forum-list-info-numbers {
display:flex;
align-items:center;
}
.forum-list-info-text {
display:flex;
align-items:center;
}
.forum-list-info-numbers h3 {
margin-right:6.3em;
font-size:1.2em;
}
.forum-list-info-text p {
margin-right:5em;
font-size:1.2em;
color:#a6afb6;
}
And my HTML:
<button>
<div class="forum-list-header">
<div class="forum-list-border"><i class="fa-solid fa-rocket fa-2xl"></i></div>
<h2>Account Boost</h2>
</div>
<div class="forum-list-info">
<div class="forum-list-info-numbers"><h3>5.1k</h3><h3>50.3k</h3></div>
<div class="forum-list-info-text"><p>Posts</p><p>Messages</p></div>
</div>
</button>
so I'm a beginner and I started this project by first writing CSS in styles.scss and then transforming the code inside of it using scss tools. I made an each loop to loop through a set of colors in my color map, placed in a mixin and put that mixin under [class^=btn].
I don't know why this doesn't work?
Here is my SCSS:
//colors
$base-grey: #808080;
$base-white: #ffffff;
$base-green: #71eeb8;
$base-blue: #2dcae6; //base-success: #33c052;
$base-red: #ff6666; //red
$base-orange: #ff751a; //warning
$base-purple: #8a54f7; //info
// grid base class
.grid {
// .grid__row
&__row {
padding: 1em 10px;
display: flex;
flex-direction: column;
// NOTE: replace with media query mixin if aiming for exceeds
#media (min-width: 768px) {
flex-direction: row;
}
}
// .grid__col
&__col {
// create grid columns dynamically
// loop through each column size
#for $i from 1 through 12 {
// concatenate CSS selector, ie when $i = 1,
// selector would be .grid__col--1
&--#{$i} {
// base styles applied to all grid columns
// NOTE: could be converted to a placeholder, along with margin
// from the media query
margin-top: 10px;
flex-basis: 100%;
border: 1px red solid;
// NOTE: replace with media query mixin if aiming for exceeds
#media (min-width: 768px) {
// base stlyes applied to all grid columns
margin-top: 0;
// make column width a percentage of the column number / total columns
flex-basis: #{$i / 12 * 100 + "%"} ;
}
}
}
}
}
// targets all elements with classes that begin with grid__col
[class^=grid__col] {
// grid__col + grid__col, targets two sibling columns
& + & {
// NOTE: replace with media query mixin if aiming for exceeds
#media (min-width: 768px) {
// add grid gutter
margin-left: 10px;
}
}
}
.grid {
&__row {
display: flex;
}
}
//BASE
.container {
text-align: left;
font-family: 'Arial Narrow', Arial,sans-serif;
color: $base-grey;
padding: 5px;
font-weight: 500;
}
p {
text-align: left;
line-height: 1.3;
}
a {
text-decoration: none;
}
//NAVIGATION
.nav {
list-style-type: none;
padding: 0;
text-align: center;
}
.nav__item a {
display: block;
color: inherit;
margin: 8px 0;
padding: 8px;
}
.nav__item a:hover {
color: $base-white;
background-color: $base-green;
}
//TYPOGRAPHY
//link
.link {
color: $base-blue;
font-weight: bold;
}
//blockquote
.blockquote {
border-left: $base-green 8px solid;
padding-left: 10px;
font-style: oblique;
font-size: 1.2em;
}
// headlines
#mixin h2-font-weight {
font-weight: 100;
}
.headline--primary {
color: $base-green;
margin-left: 10px;
}
.headline--secondary {
text-align: left;
#include h2-font-weight;
}
//FORM
.form {
display: flex;
flex-direction: column;
&__input {
border: none;
border-bottom: 2px solid $base-green;
margin-bottom: 15px;
}
&__label--hidden {
display: none;
}
& .headline--secondary {
#include h2-font-weight;
}
}
//BUTTONS
#mixin button-styles {
display: block;
width: 100%;
border: none;
margin-bottom: 15px;
padding: 10px;
color: $base-white;
text-transform: uppercase;
font-weight: bold;
}
$button-colors :(
default:$base-blue,
success:$base-green,
error:$base-red,
warning:$base-orange,
info:$base-purple
);
#mixin button-colors {
#each $button, $color in $button-colors {
.btn--#{$button} {
background-color: #{$color};
}
}
}
[class*=btn] {
#include button-styles;
}
//IMAGE
#mixin center-images {
display: block;
max-width: 100%;
margin: 0 auto;
padding: 8px;
}
[class^=img] {
#include center-images;
}
.img {
&--frame {
border: 2px solid $base-grey;
}
}
This is my HTML:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Circles UI Kit</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/normalize.css">
</head>
<!--
List of classes used
Grid:
.container
.grid__row
.grid__col--1 *NOT USED HERE
.grid__col--2 *
.grid__col--3
.grid__col--4
.grid__col--5
.grid__col--6
.grid__col--7
.grid__col--8
.grid__col--9
.grid__col--10 *
.grid__col--11 *
.grid__col--12
.card
.centered
.theme__colors
(.grid__col--1, .grid__col--2, .grid__col--10, and .grid__col--11 are not used here in the HTML but would be good to include in the Sass)
Typography:
.container
.link
.blockquote
.headline--primary
.headline--secondary
Image:
.img--logo
.img--frame
.img--avatar
Navigation:
.nav
.nav__item
Buttons:
.btn--default
.btn--success
.btn--error
.btn--warning
.btn--info
.theme__colors
Forms:
.form
.form__label--hidden
.form__input
-->
<body class="container">
<div class="grid__row">
<div class="grid__col--3">
<a class="link" href="/">
<img class="img--logo" alt="circles logo" src="images/logo.png">
</a>
</div>
<div class="grid__col--9">
<nav role="navigation">
<ul class="nav">
<li class="nav__item">Typography</li>
<li class="nav__item">Buttons</li>
<li class="nav__item">Form</li>
<li class="nav__item">Images</li>
<li class="nav__item">Grid</li>
</ul>
</nav>
</div>
</div>
<div class="grid__row">
<div class="grid__col--12">
<div class="card">
<p>This is what the navigation menu looks like when the screen is at 769px or higher. When the screen is less
than 769px,
the menu will be displayed vertically.</p>
</div>
</div>
</div>
<div class="grid__row">
<div class="grid__col--8">
<div class="card">
<h4 id="type" class="headline--secondary">Typography</h4>
<h1 class="headline--primary">Take a look at this amazing headline</h1>
<p>This is a typical paragraph for the UI Kit. Here is what a link might look like.
The
typical font family for this kit is Helvetica Neue. This kit is intended for clean and refreshing web layouts.
No jazz hands here, just the essentials to make dreams come true, with minimal clean web design. The kit comes
fully equipped with everything from full responsive media styling to buttons to form fields. <em>I enjoy using
italics as well from time to time</em>.
Fell free to create the most amazing designs ever with this kit. I truly hope you enjoy not only the kit but
this
amazing paragraph as well. :)</p>
<blockquote class="blockquote">You know what really gets me going? A really nice set of block quotes. That's
right, block quotes that say, "Hey,
I'm an article you want to read and nurture."</blockquote>
</div>
</div>
<div class="grid__col--4">
<form class="form">
<legend id="forms" class="headline--secondary">Form Elements</legend>
<img class="img--avatar" src="images/avatar.png" alt="Avatar">
<label class="form__label--hidden" for="username">Username:</label>
<input class="form__input" type="text" id="username" placeholder="Username">
<label class="form__label--hidden" for="password">Password:</label>
<input class="form__input" type="password" id="password" placeholder="Password">
<button class="btn--default theme__colors" type="submit" value="Login">Login</button>
</form>
</div>
</div>
<h4 id="images" class="headline--secondary">Images</h4>
<div class="grid__row">
<div class="grid__col--6">
<img class="img--frame" src="images/image.png" alt="sample image">
</div>
<div class="grid__col--6">
<img class="img--avatar" src="images/avatar.png" alt="Avatar">
</div>
</div>
<h4 id="buttons" class="headline--secondary">Buttons</h4>
<div class="grid__row">
<div class="grid__col--12">
<button class="btn--default theme__colors">default</button>
<button class="btn--success theme__colors">success</button>
<button class="btn--error theme__colors">error</button>
<button class="btn--warning theme__colors">warning</button>
<button class="btn--info theme__colors">info</button>
</div>
</div>
<h4 id="grid" class="headline--secondary">Grid System</h4>
<div class="grid__row">
<div class="grid__col--12 theme__colors">.grid__col--12</div>
</div>
<div class="grid__row">
<div class="grid__col--6 theme__colors">.grid__col--6</div>
<div class="grid__col--6 theme__colors">.grid__col--6</div>
</div>
<div class="grid__row">
<div class="grid__col--4 theme__colors">.grid__col--4</div>
<div class="grid__col--4 theme__colors">.grid__col--4</div>
<div class="grid__col--4 theme__colors">.grid__col--4</div>
</div>
<div class="grid__row">
<div class="grid__col--3 theme__colors">.grid__col--3</div>
<div class="grid__col--3 theme__colors">.grid__col--3</div>
<div class="grid__col--3 theme__colors">.grid__col--3</div>
<div class="grid__col--3 theme__colors">.grid__col--3</div>
</div>
<div class="grid__row">
<div class="grid__col--5 theme__colors">.grid__col--5</div>
<div class="grid__col--7 theme__colors">.grid__col--7</div>
</div>
<div class="grid__row">
<div class="grid__col--8 theme__colors">.grid__col--8</div>
<div class="grid__col--4 theme__colors">.grid__col--4</div>
</div>
<div class="grid__row">
<div class="grid__col--7 theme__colors centered">.centered .grid__col--7</div>
</div>
</body>
</html>
You are missing two things:
The mixin of button colours need to be:
#mixin button-colors {
#each $button, $color in $button-colors {
&.btn--#{$button} {
background-color: #{$color};
}
}
}
with & before .btn.
You didn't call your mixin. You need to write:
[class*=btn] {
#include button-styles();
#include button-colors();
}
I am trying to resize my button so it is smaller, more mobile friendly, and only shows the symbol when minimized (versus the symbol and text).
The goal is to have the button appear on the same row as the header on the right-hand side. I also only want to show the symbol, while the text will disappear, only reappearing if the screen size is bigger.
I've tried adjusting the width through media queries and the positioning of the button, but haven't had any luck.
Mobile Version
<!-- Table -->
<div class="container-fluid">
<!-- Mini Row -->
<div class="row">
<div class="col-md-12">
<h3 class="d-inline-block">Welcome!</h3>
<button type="button" class="btn btn-add float-right" id="add invoice"><i class="fas fa-plus-circle"></i>Add Invoice</button>
</div>
</div>
<!-- End of Mini Row -->
#add-invoice {
font-family: "FjallaOne-Regular";
font-size: 1em !important;
color: black;
background-color: rgb(0, 200, 0);
margin-top: 4.5em;
margin-right: 1.75em;
}
/* Media Queries */
#media only screen and (max-width: 480px) {
h3 {
margin-left: -.25em
}
#add-invoice {
margin: -1em;
margin-top: 4.5em;
}
}
wrap your Button text on span tag & add a media query
#media (max-width: 400px) {
.btn span{display:none;}
}
<!-- Mini Row -->
<div class="row">
<div class="col-md-12">
<h3 class="d-inline-block">Welcome!</h3>
<button type="button" class="btn btn-add float-right" id="add invoice"><i class="fa fa-plus-circle"></i> <span>Add Invoice</span></button>
</div>
</div>
https://jsfiddle.net/lalji1051/4tm968rz/4/
Add span tag in button
<button type="button" class="btn btn-add float-right" id="add-invoice">
<i class="fas fa-plus-circle"></i><span>Add Invoice</span></button>
and than css
#media only screen and (max-width: 480px) {
#add-invoice span{
display:none;
}
}
Try this one
#add-invoice {
font-family: "FjallaOne-Regular";
font-size: 1em !important;
color: black;
background-color: rgb(0, 200, 0);
margin-top: 4.5em;
margin-right: 1.75em;
}
/* Media Queries */
#media only screen and (max-width: 480px) {
h3 {
margin-left: -.25em
}
#add-invoice {
margin: -1em;
margin-top: 4.5em;
font-size: 0.5em !important;
}
}
<!-- Table -->
<div class="container-fluid">
<!-- Mini Row -->
<div class="row">
<div class="col-md-12">
<h3 class="d-inline-block">Welcome!</h3>
<button type="button" class="btn btn-add float-right" id="add invoice"><i class="fas fa-plus-circle"></i>Add Invoice</button>
</div>
</div>
<!-- End of Mini Row -->
I'm trying to have all images in my flex container have the same height using a 4:3 ratio, all of this being responsive.
When out of the flex container everything works well, but when put in it, it seems like it's the length of the title that dictates the width. I can't figure out why.
https://jsfiddle.net/ts8Lwp6g/
/* Just copying the guy in vid for now, trying to figure it all out hopefully it won't be too much of a bother responsive eh ffs , somethings I haven't copied, tryna do best */
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
background-color: gray;
width: 80%;
margin: auto;
}
#cccccc {
background-color: orange;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.w {
background-color: red;
/* doesnt show hay */
display: block;
}
.views {
float: left
}
.rating {
float: right
}
.parentt {
max-width: 258px;
}
.containertt {
width: 100%;
position: relative;
padding-bottom: 75%;
/* 34.37% = 100 / (w / h) = 100 / (640 / 220) */
}
.containertt img {
width: 100%;
height: 100%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.figcaptionnnn {
/* background-color:red; */
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%
}
.figcaptionnnn a {
color: white;
text-decoration: none;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="tete.css">
</head>
<body>
<div id="cccccc">
<div class="parentt">
<div class="containertt">
<img height="145" width="258" src="https://s3-us-west-2.amazonaws.com/i.cdpn.io/221971.RajoRb.7fb2f73a-0b7d-4aa3-ac25-f0f31261cdae.png" />
</div>
<div class="figcaptionnnn">
<span class="titlee"><a href=https://pornhub.com/view_video.php?viewkey=1306454068 title="Tall french maid and batman" >Tall french maid and batman</a></span></br>
<div class="w"><span class="views"> 692818 views</span><span class="rating">75 %</span></div>
</div>
</div>
<div class="parentt">
<div class="containertt">
<img height="145" width="258" src="https://s3-us-west-2.amazonaws.com/i.cdpn.io/221971.RajoRb.7fb2f73a-0b7d-4aa3-ac25-f0f31261cdae.png" />
</div>
<div class="figcaptionnnn">
<span class="titlee"><a href=https://pornhub.com/view_video.php?viewkey=1306454068 title="Tall french maid and batman" >Tall french maid and batman vdfvdsv dvdfv ddffv dvddv dvdcffc dvdfcd</a></span><br/>
<div class="w"><span class="views"> 692818 views</span><span class="rating">75 %</span></div>
</div>
</div>
</div>
<div class="parentt">
<div class="containertt">
<img height="145" width="258" src="https://s3-us-west-2.amazonaws.com/i.cdpn.io/221971.RajoRb.7fb2f73a-0b7d-4aa3-ac25-f0f31261cdae.png" />
</div>
<div class="figcaptionnnn">
<span class="titlee"><a href=https://pornhub.com/view_video.php?viewkey=1306454068 title="Tall french maid and batan" >Tall french maid and batman</a></span></br>
<div class="w"><span class="views"> 692818 views</span><span class="rating">75 %</span></div>
</div>
</div>
<div class="parentt">
<div class="containertt">
<img height="145" width="258" src="https://s3-us-west-2.amazonaws.com/i.cdpn.io/221971.RajoRb.7fb2f73a-0b7d-4aa3-ac25-f0f31261cdae.png" />
</div>
<div class="figcaptionnnn">
<span class="titlee"><a href=https://pornhub.com/view_video.php?viewkey=1306454068 title="Tall french maid and batman" >Tall french maid and batman vdfvdsv dvdfv ddffv dvddv dvdcffc dvdfcd</a></span></br>
<div class="w"><span class="views"> 692818 views</span><span class="rating">75 %</span></div>
</div>
</div>
</body>
</html>