I have a problem with an <i> element that must be seen only in a media query. The problem is I can see everything works fine in my inspector, but despite <i> takes the right font-size, and takes the right space, it doesn't take the color I gave it. The inspector even shows the right color without problems, but the element doesn't take it, it takes the background color of the section, making it impossible to be seen.
The one I want to show in the media query is id="footer-left-options", the other two above not.
Here some code to help
/*footer-left*/
.footer-section-left {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
.footer-album-cover {
width: 50px;
min-width: 40px;
cursor: pointer;
}
.footer-album-cover img {
width: 100%;
}
.footer-album-info {
margin-left: 10px;
margin-right: 30px;
cursor: pointer;
}
.footer-album-info-artist a {
font-size: 10px;
color: #8d8d8d;
text-decoration: none;
}
.footer-album-info-artist a:hover {
text-decoration: underline;
}
.footer-icon-left>i {
color: #797979;
font-size: 16px;
font-weight: 500;
padding-right: 10px;
cursor: pointer;
}
.footer-icon-left>i:hover {
color: white;
}
#footer-left-options {
display: none;
}
#media all and (max-width: 532px) {
.footer-section-left {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
}
.footer-album-cover {
width: 30px;
min-width: 30px;
}
.footer-album-info {
margin-left: 0;
margin-right: 0;
}
.footer-icon-left>i {
display: none;
}
#footer-left-options {
padding-right: 0;
display: block;
}
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css" integrity="sha512-HK5fgLBL+xu6dm/Ii3z4xhlSUyZgTT9tuc/hSrtw6uzJOvgRr2a9jyxxT1ely+B+xFAmJKVSTbpM/CuL7qxO8w==" crossorigin="anonymous" />
<!--footer-left-->
<div class="footer-section-left">
<div class="footer-album-cover">
<img src="img/sinister.jpeg" alt="Sinister">
</div>
<div class="footer-album-info">
<div class="footer-album-info-title">Sinister</div>
<div class="footer-album-info-artist">
Brano nome
</div>
</div>
<div class="footer-icon-left">
<i class="far fa-heart"></i>
<i class="far fa-folder"></i>
<i id="footer-left-options" class="fas fa-ellipsis-h"></i>
</div>
</div>
The problem is the font-weight, since the <i> inherited the font-weight:500 from the previous rule:
.footer-icon-left>i {
color: #797979;
font-size: 16px;
font-weight: 500;
padding-right: 10px;
cursor: pointer;
}
Thanks to this site https://www.amp-blogger.com/2019/01/font-awesome-5-not-working-on-css.html I've found the answer. The <i> I've token from Font Awesome was this https://fontawesome.com/icons/ellipsis-h?style=solid and opening the link you can see that the icon is described as "solid" and has two pro version both in "regular" and "light" font-weight. Now, since 500 isn't solid (bold), the icon took the color I wanted for it, but didn't display at all! Changing font-weight to font-weight:800 solves the problem, the icon shows itself regularly and the color is correct.
Thanks everybody for the help!
/*footer-left*/
.footer-section-left {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
.footer-album-cover {
width: 50px;
min-width: 40px;
cursor: pointer;
}
.footer-album-cover img {
width: 100%;
}
.footer-album-info {
margin-left: 10px;
margin-right: 30px;
cursor: pointer;
}
.footer-album-info-artist a {
font-size: 10px;
color: #8d8d8d;
text-decoration: none;
}
.footer-album-info-artist a:hover {
text-decoration: underline;
}
.footer-icon-left>i {
color: #797979;
font-size: 16px;
font-weight: 500;
padding-right: 10px;
cursor: pointer;
}
.footer-icon-left>i:hover {
color: red;
}
#footer-left-options {
display: none;
}
#media all and (max-width: 532px) {
.footer-section-left {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
}
.footer-album-cover {
width: 30px;
min-width: 30px;
}
.footer-album-info {
margin-left: 0;
margin-right: 0;
}
#footer-left-options {
padding-right: 0;
display: block;
}
}
<script src="https://kit.fontawesome.com/f10f36656a.js" crossorigin="anonymous"></script>
<!--footer-left-->
<div class="footer-section-left">
<div class="footer-album-cover">
<img src="img/sinister.jpeg" alt="Sinister">
</div>
<div class="footer-album-info">
<div class="footer-album-info-title">Sinister</div>
<div class="footer-album-info-artist">
Brano nome
</div>
</div>
<div class="footer-icon-left">
<i class="far fa-heart"></i>
<i class="far fa-folder"></i>
<i id="footer-left-options" class="fas fa-ellipsis-h"></i>
</div>
</div>
Related
I have a code as follows:
<div className="wrapper">
<i class="fa fa-quote-left" style="font-size: 10rem;"></i>
<div class="text">Title</div>
</div>
With next css:
.wrapper{
display: flex;
flex-direction: column;
border: 2px solid #f8f8f8;
}
.text{
font-size: 16px;
font-weight: 300;
margin-top: 0.25rem;
}
Why my icon takes more space than it should take.
How can I remove it?
Here is the fiddle.
not the best way but you can use line-height
for example :
i{
font-size: 10rem;
line-height: 7rem;
margin-top: 1rem;
}
I am trying to create a Donation card for my site with the help of this. I am Almost done with code changes but unable to set the layout, it's not showing properly. All contents are overlapping. I tried to set a margin but that is not working.
$(function () {
// Whitelist buttons in popovers
var myDefaultWhiteList = $.fn.tooltip.Constructor.Default.whiteList
myDefaultWhiteList.button = [];
// Customizer popover
var $tip = $('.btn-donate').popover({
trigger: 'manual', // We don't want popover to launch when we don't need it :)
html: true,
offset: '-100px, 0',
container: 'body',
content: function () {
return '<p>' + $(this).data('description') + '</p><button class="btn btn-sm btn-dismiss white-text z-depth-0 pr-0">Got it</button>';
},
template: '<div class="popover popover-blue" role="tooltip"><div class="arrow"></div><div class="popover-body"></div></div>'
});
// Manually show popover
$tip.popover('show');
// Handle popover dismiss
$('.btn-dismiss').on('click', function () {
$tip.popover('hide');
});
});
body{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
flex-direction: column;
background: #F0F0F0;
}
:root {
--yt-blue: #ea5b18; /* This is a custom color used by YouTube */
}
/* Custom card header */
.card-header {
display: flex;
position: relative;
justify-content: space-between;
padding-left: 16px !important;
align-items: center;
height: 48px;
overflow: hidden;
}
.donate-icon {
display: flex;
align-self: stretch;
align-items: center;
position: relative;
padding-right: 1.2rem;
float: right;
background: #ea5b18;
}
.donate-icon:before {
content: "";
position: absolute;
display: block;
width: 48px;
height: 48px;
transform: rotate(45deg) translate(-50%,50%);
background: #ea5b18;
}
.donate-icon i {
color: #187415;
background: #fff;
padding: 8px;
z-index: 1;
border-radius: 50%;
}
.avatar {
max-width: 50px;
}
.fundraiser {
display: flex;
align-items: flex-start;
}
.fundraiser .name {
font-size: 1rem;
}
.fundraiser .creator {
font-size: 1rem;
}
.fundraiser .details {
flex: 1;
}
/* Ugly workaroung - sorry :( */
.btn-donate, .btn-donate:hover, .btn-donate:active, .btn-donate:focus {
background: var(--yt-blue);
position: relative;
color: #fff;
}
.sum {
text-align: center;
font-weight: 500;
}
.card-footer a {
font-size: .785rem;
font-weight: 500;
}
/* Popover styles */
.popover-blue {
background: var(--yt-blue);
border-radius: 1;
}
.popover-blue .arrow:after {
border-bottom-color: var(--yt-blue) !important;
}
.popover-blue .popover-body {
color: #fff;
font-size: 1rem;
}
.btn-dismiss {
float: right;
box-shadow: none;
}
<div class="card mt-4 mx-auto" style="max-width: 25rem;">
<div class="card-header p-0">
<span class="d-inline-block card-title mb-0">Donate now</span>
<span class="donate-icon">
<i class="fas fa-hand-holding-heart"></i>
</span>
</div>
<div class="card-body">
<div class="fundraiser">
<img src="https://t3.ftcdn.net/jpg/04/06/35/70/360_F_406357077_MWIAoFRKa7qmoLhr44pTraEzmF5rTFhf.jpg" class="avatar" />
<div class="details px-2">
<h3 class="name mb-0"><strong>Magic Logic</strong></h3>
<span class="creator text-muted">paypal.me/MagicLogic</span>
</div><a href="https://www.paypal.com/paypalme/MagicLogic" title="Donate">
<button class="btn btn-md btn-donate z-depth-0" data-toggle="popover" data-placement="bottom"
data-description="You can buy me a cup of Coffee or something via PayPal.">Donate</button></a>
</div>
Trying to create something like this:
You almost had it. Just needed to update the layout details in your Flexbox containers. This should get you going in the right direction. I will leave it up to you to figure out where you went wrong with displaying the circular hand with heart icon in the top right corner.
Secondly, you didn't provide the <script> tag to include jQuery in your project or a <link> to Bootstrap. Which the page you provided here uses to create the tooltip. After adding the jQuery <script>'s right before the closing <body> tag and including the Bootstrap <link> in the <head>, the tooltip displays correctly.
$(function () {
// Whitelist buttons in popovers
var myDefaultWhiteList = $.fn.tooltip.Constructor.Default.whiteList
myDefaultWhiteList.button = [];
// Customizer popover
var $tip = $('.btn-donate').popover({
trigger: 'manual', // We don't want popover to launch when we don't need it :)
html: true,
offset: '-100px, 0',
container: 'body',
content: function () {
return '<p>' + $(this).data('description') + '<button class="btn btn-sm btn-dismiss white-text z-depth-0 pr-0">Got it</button></p>';
},
template: '<div class="popover popover-blue" role="tooltip"><div class="arrow"></div><div class="popover-body"></div></div>'
});
// Manually show popover
$tip.popover('show');
// Handle popover dismiss
$('.btn-dismiss').on('click', function () {
$tip.popover('hide');
});
});
body{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
flex-direction: column;
background: #F0F0F0;
}
:root {
--yt-blue: #ea5b18; /* This is a custom color used by YouTube */
}
/* Custom card header */
.card-header {
display: flex;
position: relative;
justify-content: space-between;
padding-left: 16px !important;
align-items: center;
height: 48px;
overflow: hidden;
background: rgb(249, 249, 249);
border: .1rem solid lightgray;
}
.card-title {
padding: .25rem .6rem;
}
.donate-icon {
display: flex;
align-self: stretch;
align-items: center;
position: relative;
padding-right: 1.2rem;
float: right;
background: #ea5b18;
}
.donate-icon:before {
content: "";
position: absolute;
display: block;
width: 48px;
height: 48px;
transform: rotate(45deg) translate(-50%,50%);
background: #ea5b18;
}
.donate-icon i {
color: #187415;
background: #fff;
padding: 8px;
z-index: 1;
border-radius: 50%;
}
.avatar {
max-width: 50px;
}
.fundraiser {
display: flex;
align-items: center;
background: #fff;
border-radius: .1rem;
}
.fundraiser .details.px-2 {
margin: 0 1rem 0 .5rem;
}
.fundraiser .name {
font-size: 1rem;
margin: .15rem 0;
}
.fundraiser .creator {
font-size: 1rem;
color: #555;
}
.fundraiser .details {
flex: 1;
}
.btn-donate {
margin-top: .1rem;
padding: .75rem 1.25rem;
border: none;
text-transform: uppercase;
font-size: .8rem !important;
border-radius: .1rem;
background: #ea5b18 !important;
color: #fff !important;
}
.btn-donate, .btn-donate:hover, .btn-donate:active, .btn-donate:focus {
position: relative;
color: #fff;
cursor: pointer;
}
.sum {
text-align: center;
font-weight: 500;
}
.card-footer a {
font-size: .785rem;
font-weight: 500;
}
/* Popover styles */
.popover-blue {
border-radius: 1;
}
.popover-blue .arrow:after {
border-bottom-color: var(--yt-blue) !important;
}
.popover-blue .popover-body {
color: #fff;
background-color: #ea5b18;
font-size: 1rem;
height: 6rem;
}
.btn-dismiss {
margin-top: 1.5rem;
color: #fff !important;
float: right;
box-shadow: none;
}
.bs-popover-top > .arrow::after {
border-top-color: #ea5b18 !important;
}
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<div class="card mt-4 mx-auto" style="max-width: 25rem;">
<div class="card-header p-0">
<span class="d-inline-block card-title mb-0">Donate now</span>
<span class="donate-icon">
<i class="fas fa-hand-holding-heart"></i>
</span>
</div>
<div class="card-body">
<div class="fundraiser">
<img src="https://t3.ftcdn.net/jpg/04/06/35/70/360_F_406357077_MWIAoFRKa7qmoLhr44pTraEzmF5rTFhf.jpg" class="avatar" />
<div class="details px-2">
<h3 class="name mb-0"><strong>Magic Logic</strong></h3>
<span class="creator text-muted">paypal.me/MagicLogic</span>
</div><a href="https://www.paypal.com/paypalme/MagicLogic" title="Donate">
<button class="btn btn-md btn-donate z-depth-0" data-toggle="popover" data-placement="bottom"
data-description="You can buy me a cup of Coffee or something via PayPal.">Donate</button></a>
</div>
<!-- You must include the jQuery and Bootstrap scripts -->
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
</body>
I'm building the traditional todo list app in an effort to increase my understanding of Vuejs. Most of the functionality is working as expected, however my todo items are not displaying properly. Each item should have a "delete" button that shows up on the right side of its row, but the buttons are bleeding into the row below (see image).
What irks me is that the checkboxes are displaying properly, but the buttons are not. I've tried changing all the css for the buttons to that for the checkbox, but this didn't work
TodoItem.vue
<template lang="html">
<li class="todo-item" v-bind:class="{ 'is-complete': todo.completed }">
<div class="checkbox-holder">
<input type="checkbox" v-on:change="markComplete(todo.id)" />
</div>
<h2>{{ todo.title }}</h2>
<button v-on:click="deleteTodo(todo.id)" class="del">x</button>
</li>
</template>
App.scss
.todos {
position: absolute;
display: block;
width: 656px;
background-color: white;
margin-left: 266px;
border-right: $generic-border;
min-height: calc(100vh);
padding-left: 40px;
padding-right: 40px;
padding-top: 80px;
padding-bottom: 80px;
#include mq("900px") {
margin-left: 0;
width: auto;
}
h2 {
font-size: 20px;
font-weight: normal;
}
&__list li {
line-height: 1.4;
color: #333;
font-size: 14px;
list-style-type: none;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 20px;
margin-top: 20px;
padding: 20px;
&.is-complete {
text-decoration: line-through;
}
button {
#include btn("30px");
float: right;
display: block;
}
.checkbox-holder {
margin-right: 20px;
margin-left: 20px;
align-items: center;
justify-content: center;
line-height: 16px;
float: left;
.checkbox {
cursor: pointer;
border-color: gray;
color: #343434;
height: 16px;
width: 16px;
border: 1px solid gray;
border-radius: 16px;
}
}
}
}
Here's how the buttons are displaying.
You can see the below code.
li {
display: flex;
align-items: center;
}
<ul>
<li class="todo-item">
<div class="checkbox-holder">
<input type="checkbox"/>
</div>
<h2>Hello world</h2>
<button>x</button>
</li>
</ul>
If you look at the demo in fullscreen, I'm trying to align all of the inner contents of each div - e.g. You'll notice that the middle cyan div’s contents are not aligned equally with the first and third cyan divs’ contents.
It's difficult to explain, but look at the position of the icon in the middle cyan div compared to the others. If there's a different amount of text inside of each div, how can I make it so that the inner contents are all aligned vertically with the other cyan divs?
.sections {
background: #f2f2f2;
width: 100%;
height: auto;
text-align: center;
padding: 100px 10%;
box-sizing: border-box;
}
#foster-cta-wrap {
background: yellow;
display: flex;
justify-content: space-evenly;
flex-direction: row;
align-items: center;
flex-flow: row wrap;
}
.foster-cta {
box-sizing: border-box;
width: 250px;min-width: 250px;
height: 200px;
background: cyan;
border: 1px solid grey;
margin-top: 30px;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
display: inline-flex;
}
.foster-top {
display: block;
font-size: 30px;
}
.foster-middle {
display: block;
text-transform: uppercase;
font-size: 22px;
font-weight: 400;
}
.foster-bottom {
display: block;
font-weight: 300;
font-size: 16px;
}
.foster-cta:hover {
background: lightgreen;
cursor: pointer;
}
.foster-top a:link, .foster-top a:visited, .foster-middle a:link, .foster-middle a:visited, .foster-bottom a:link, .foster-bottom a:visited {
text-decoration: none;
color: #333;
}
<section class="sections">
<article id="foster-cta-wrap">
<nav class="foster-cta">
<span class="foster-top">icon</span>
<span class="foster-middle">search engine optimisation</span>
<span class="foster-bottom">increase the rankings in search results.</span>
</nav><!--
--><nav class="foster-cta">
<span class="foster-top">icon</span>
<span class="foster-middle">SEO</span>
<span class="foster-bottom">increase the rankings in search results.</span>
</nav><!--
--><nav onclick="location.href='#';" class="foster-cta">
<span class="foster-top">icon</span>
<span class="foster-middle">search engine optimisation</span>
<span class="foster-bottom">increase the rankings in search results.</span>
</nav>
</article>
</section>
.sections {
background: #f2f2f2;
width: 100%;
height: auto;
text-align: center;
padding: 100px 10%;
box-sizing: border-box;
}
#foster-cta-wrap {
background: yellow;
display: flex;
justify-content: space-evenly;
flex-direction: row;
align-items: center;
flex-flow: row wrap;
}
.foster-cta {
box-sizing: border-box;
width: 250px;min-width: 250px;
height: 200px;
background: cyan;
border: 1px solid grey;
margin-top: 30px;
text-align: center;
}
.foster-top {
display: block;
font-size: 30px;
padding: .5em;
}
.foster-middle {
display: block;
text-transform: uppercase;
font-size: 22px;
font-weight: 400;
}
.foster-bottom {
display: block;
font-weight: 300;
font-size: 16px;
}
.foster-cta:hover {
background: lightgreen;
cursor: pointer;
}
.foster-top a:link, .foster-top a:visited, .foster-middle a:link, .foster-middle a:visited, .foster-bottom a:link, .foster-bottom a:visited {
text-decoration: none;
color: #333;
}
<section class="sections">
<article id="foster-cta-wrap">
<nav class="foster-cta">
<span class="foster-top">icon</span>
<span class="foster-middle">search engine optimisation</span>
<span class="foster-bottom">increase the rankings in search results.</span>
</nav>
<nav class="foster-cta">
<span class="foster-top">icon</span>
<span class="foster-middle">SEO</span>
<span class="foster-bottom">increase the rankings in search results.</span>
</nav>
<nav onclick="location.href='#';" class="foster-cta">
<span class="foster-top">icon</span>
<span class="foster-middle">search engine optimisation</span>
<span class="foster-bottom">increase the rankings in search results.</span>
</nav>
</article>
</section>
This is what I would do: I removed all the flex formatting on .foster-cta and replaced it with text-align: center;. Then, I added padding to .foster-top to make it look nicer and not contact the other text. The caption is now pushed up against the main title, but this can be fixed by setting padding / margin values for either of them.
I have a section at the top of my site which contains a background image and text with a black strip at the bottom for the ability to embed video etc (see more / see our showreel) in the future. I've just altered some styling and now the black strip won't stretch across the whole page. It worked before now it doesn't work and I can't get it to go back. Can anyone see what might be causing this?
body {
font-family: "Merriweather Sans", sans-serif !important;
font-size: 16px !important;
line-height: 1.5 !important;
color: #333333;
}
body {
margin: 0 auto 0 auto;
}
.container {
margin: auto;
max-width: 100%;
padding-left: 10px !important;
padding-right: 10px !important;
}
section#topimageagency {
height: 400px;
background: url('http://localhost:8888/wp-content/uploads/2017/07/VIDEO.jpg') center center no-repeat;
background-size: 100%;
background-position: center;
overflow: hidden;
position: relative;
}
section#topimageagency .showreel {
height: 50px;
max-width: 100% !important;
position: absolute;
background-color: black;
bottom: 0;
padding: 0 30px;
justify-content: space-between !important;
}
section#topimageagency .showreel, .showreel > div.seemore {
display: flex;
align-items: center !important;
justify-content: flex-start !important;
flex:1;
}
section#topimageagency .showreel, .showreel > div.seeour {
justify-content: flex-end;
flex:1;
display: flex;
align-items: center;
}
section#topimageagency .showreel p {
font-size: 15px;
font-weight: normal;
margin: 0;
padding-left: 10px;
color: #ffffff;
}
.showreel i {
color: #ffffff;
}
.seemore {
margin-left: 30px !important;
}
.seeour i {
margin-right: 30px !important;
}
#topimageagency a {
text-decoration: none;
color: #FFFFFF;
/* position: static; */
float: right;
background-color: #000000;
padding:5px;
padding-left:10px;
padding-right: 10px;
width:auto;
white-space: nowrap;
}
section#agency .text {
float: left !important;
margin-top: 50px;
margin-bottom: 50px;
left: 100px;
}
.text p {
font-size: 10px;
color: #FFFFFF;
}
.text h1, h2 {
color: #FFFFFF;
margin: 0;
padding: 0;
border: 0;
}
.text h2 {
line-height: 5px;
font-size: 25px;
font-weight: 200;
}
.text h1 {
font-size: 50px;
margin-bottom: 40px;
}
<section id="topimageagency">
<div class="container">
<a href="http://localhost:8888/products/">
I'm a business
</a>
<div class="text">
<h2>VIDEO & ANIMATION</h2>
<h1>FOR AGENCY</h1>
<p><?php the_field('agency_img_paragraph'); ?></p>
</div>
</div>
<div class="container showreel">
<div class="seemore">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x" style="color:#fff"></i>
<i class="fa fa-chevron-down fa-stack-1x" style="color: #000000;"></i>
</span>
<p>SEE MORE</p>
</div>
<div class="seeour">
<p>SEE OUR SHOWREEL</p>
<i class="fa fa-play-circle fa-3x" aria-hidden="true"></i>
</div>
</div>
</div>
</section>
Give the strip a width: 100%; attribute
For bottom strip to be acroos whole page:
.showreel{
width:100vw;
}