Button and Text distance too far - html

I have 4 button and text arrange in each column. ( see picture bellow)
My problem is text title of button is too far from icon.
my css:
.ButtonPDetails {
font-size:10px !important;
overflow: hidden;
white-space: nowrap;
}
.col{
text-align:center !important;
}
.rowL{
padding-bottom:0px !important;
margin:0px !important;
}
.my-icon:before,
.my-icon{
font-size:20px !important;
display:block !important;
line-height: 40px !important;
}
Here my html:
<div class="row rowL">
<div class="col">
<a href="" class="button button-icon ButtonPDetails">
<i class="icon ion-bag my-icon" style="padding: 0px;margin: 0px"></i>
{{$root.themeConfig.lblPlaceOrder}}
</a>
</div>
<div class="col">
<a href="" class="button button-icon ButtonPDetails">
<i class="icon ion-ios-cart my-icon" style="padding: 0px;margin: 0px"></i>
{{$root.themeConfig.lblAddToCart}}
</a>
</div>
<div class="col">
<a href="" class="button button-icon ButtonPDetails">
<i class="icon ion-ios-information-outline my-icon" style="padding: 0px;margin: 0px"></i>
{{$root.themeConfig.lblInfo}}
</a>
</div>
<div class="col">
<a href="" class="button button-icon ButtonPDetails">
<i class="icon ion-android-globe my-icon" style="padding: 0px;margin: 0px"></i>
{{$root.themeConfig.lblShare}}
</a>
</div>
</div>
i want distance between button and text about 5px.
please help me solve this.

If you don't have access to the generated HTML/CSS that renders the content inside the {{ }} tags, which is the real culprit, then you may be able to work around it by modifying your CSS for my-icon
.my-icon {
font-size:20px !important;
display:block !important;
line-height: 40px !important;
padding: 0px !important;
margin: 0px 0px -20px !important; /* top, right/left, bottom */
}
And remove the CSS inline in the HTML.
The -20px bottom margin may compensate for the padding added by the generated HTML.

Related

Why Won't The Float Right Class Move My Icon to Far Right Of Border Box

I have a border box which I am trying to a icon to the far right of the border box using bootstrap 4.3 class float-right but the icon does not move and I can't understand why. I have a child component in which the scss is associated with. I have tried a combination of things but it still does not work. Can someone explain to me what the issue is. Code snippet includes.
Cartitem.html
<div class="container-md" style="height:50%; width:150px;">
<img class="img-fluid" [src]="cartItem.imageUrl" alt="Cart Item">
<div class="text-nowrap" style="font-size:13px; width: 400px">{{cartItem.productName}}
</div>
<div style="font-size:13px"><strong>{{ (cartItem.price) | currency}}</strong></div>
<div class="float-right" style=" clear:both">
<span ><i class="fa-solid fa-trash-can" style="color:#D30169;cursor: pointer;
">
</i></span>
</div>
</div>
cart.html
<div class="container" style="margin-bottom:20px">
<h1 style="text-align: center">Shopping Cart</h1>
<div class="cart-borderBox">
<div class="inside-bB">
div *ngFor="let item of cartItems; let i = index">
<app-cart-item [cartItem]="item"></app-cart-item>
</div>
</div>
</div>
</div>
scss
.cart-borderBox{
box-sizing: border-box;
margin: 0 auto;
/*height: auto;*/
width: 70%;
}
.inside-bB{
border: 3px solid $primary-color;
padding: 50px;
margin:0 auto;
border-radius: 8px;
}

To make whole div clickable?

I have a template of handlebars in which there are multiple div which i need to make clickable.
However, in my div the text is dynamic, how will i be able to make whole div clickable. Here is the code
<div class="row">
{{#each event}} {{#is this.event ../eventName }}
<div class="col s12 m3 13 al">
<div class="card ">
<div class="card-image">
<img src="/Small/{{this.imageId}}.JPG">
<span class="imageClick"></span>
</div>
<div class="card-action sp1">
<div class="action-time">
<a href="/{{this.imageId}}/love" class="like sp">
<i class="material-icons fav">favorite</i>
</a>
<span id="{{this.imageId}}" class="like-text">{{this.love}}</span>
</div>
<div class="action-time">
<a href="/{{this.imageId}}/laugh" class="haha sp">
<i class="material-icons laugh">sentiment_very_satisfied</i>
</a>
<span id="{{this.imageId}}laugh" class="haha-text">{{this.laugh}}</span>
</div>
<div class="action-time">
<a href="/{{this.imageId}}/sad" class="downvote sp">
<i class="material-icons down">trending_down</i>
</a>
<span id="{{this.imageId}}sad" class="downvote-text">{{this.sad}}</span>
</div>
{{!-- {{this.imageId}} --}}
</div>
<div class="card-action">
<a class="waves-effect waves-light btn share">button</a>
</div>
</div>
</div>
{{/is}} {{/each}}
I want to make my div action-time clickable with the link in the a tag. I tried to use the popular <span> solution like this but no use. It works for the last action-time making first two not working. How can i solve this.
Css code for action-time and card is:
.action-time{
display: inline-block;
border: 1px solid rgba(202, 202, 202, 0.733);
width: 32%;
padding-top:2px;
padding-left: 4px;
border-radius:8px;
}
and for card :
.card {
margin: 10px;
padding: 5px;
border-radius: 8px;
box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
}
.card-action {
padding: 5px 0px !important;
/* padding-right: 5px !important; */
}
Here is what my webpage looks like, I have multiple of those cards
I want to make the whole area in border of heart clickable, rather than just the image to heart.
You can update your html so that the <span> is inside your <a>.
<a href="/{{this.imageId}}/laugh" class="haha sp">
<i class="material-icons laugh">sentiment_very_satisfied</i>
<span id="{{this.imageId}}laugh" class="haha-text">{{this.laugh}}</span>
</a>
Displaying your <a> as a block element will have it fill up the entire <div>. Then you can float your <span> to the right and style it accordingly until it's where you want it exactly.
.action-time a {
display: block;
}
.action-time span {
float: right;
}
You can write some javascript to handle the operation
$(" .action-time").click(function() {
window.location = $(this).find("a").attr("href");
return false;
});
Looks for a link inside div with class of "action-time". Redirects to that links value when anywhere in div is clicked.

Elements on Higher Z-Index Being Influenced by Transparent Div on Lower Z-Index

I have a pretty simple setup for a web page, consisting of a grid of divs, headers, and i elements:
All I want to do is add a div with a background color and a header behind this grid, with the elements of the grid appear on top of the new background div.
However, when I try to do this, I get this:
As you can see, the transparent color of the background div is overlapping the buttons, only in the grid.
I've made sure to adjust the z-index of all elements (the background div, the grid and all of it's elements) so that they do have higher z-index value than the background div.
Here is my HTML and CSS:
HTML
<html>
...
<body>
<div id="sfa3features"><h1>New SFA3 Features!</h1></div>
...
<div class="wrapper-how-to" id="grid-menu3">
<div class="row-top"></div>
<h2 class="row-top label-cell">Setting</h2>
<div class="row-top"></div>
<div class="row-top"></div>
<div class="row-top"></div>
<div class="row-top"></div>
<i class="image-cell fa fa-info-circle fa-2x"></i>
<h3 class="label-cell">Combo Items</h3>
<div id="combo_items_finding" class="box-how-to enabled"><h3>Finding</h3> <span class="popup popup-how-to" id="popup_combo_items_finding" > </div>
<div id="combo_items_updating" class="box-how-to impossible"><h3>Updating</h3> <span class="popup popup-how-to" id="popup_combo_items_updating" ></div>
<div id="combo_items_entering" class="box-how-to enabled"><h3>Entering</h3> <span class="popup popup-how-to" id="popup_combo_items_entering" ></div>
<div id="combo_items_linking" class="box-how-to impossible"><h3>Linking</h3><span class="popup popup-how-to" id="popup_combo_items_linking" ></div>
</div>
<div class="wrapper-how-to" id="grid-menu4">
<div class="row-top"></div>
<h2 class="row-top label-cell">Pickbox</h2>
<div class="row-top"></div>
<div class="row-top"></div>
<div class="row-top"></div>
<div class="row-top"></div>
<i class="image-cell fa fa-folder-o fa-2x"></i>
<h3 class="label-cell">Pickbox</h3>
<div id="pickbox_finding" class="box-how-to enabled"><h3>Finding</h3> <span class="popup popup-how-to" id="popup_pickbox_finding" > </div>
<div id="pickbox_updating" class="box-how-to enabled"><h3>Updating</h3> <span class="popup popup-how-to" id="popup_pickbox_updating" ></div>
<div id="pickbox_entering" class="box-how-to enabled"><h3>Entering</h3> <span class="popup popup-how-to" id="popup_pickbox_entering" ></div>
<div id="pickbox_linking" class="box-how-to impossible"><h3>Linking</h3><span class="popup popup-how-to" id="popup_pickbox_linking" ></div>
</div>
...
</body>
</html>
CSS
.wrapper-how-to {
display: grid;
grid-gap: 10px;
grid-template-columns: 5% 22% 16% 16% 16% 16%;
background-color: transparent;
color: #444;
margin: 2.5% auto !important;
}
.wrapper-how-to h2,
.wrapper-how-to h3,
.wrapper-how-to div,
.wrapper-how-to i
{
z-index:2;
}
#sfa3features{
/*Should be the same as coverup5, but back layer*/
display: flex;
position: absolute;
width: 105%;
left:-4%;
align-items: flex-start;
justify-content: center;
background-color: rgba(255, 219, 89,0.8);
border-color: rgb(252, 204, 30);
border-style: solid;
border-radius: 8px;
border-width: 5px;
z-index: -1;
height: 400px;
top:1485px;
}
Any idea what's going on?
I was getting confused. The div elements have a transparent color. Of course they will use the background div's color as well.
Switching CSS to opaque colors should solve the problem.
Had the same problem, it really was because I was using an transparent color.

zurb foundation 5 icon bar Text Misaligned

I have a weird issue with the text under the icon bar not being centered under the icons.
code example
<div class="row">
<div class="small-12 columns">
<div class="icon-bar five-up small">
<a class="item" a href="/index.html">
<i class="fi-home"></i>
<div>
<label>Home</label>
</div>
</a>
<a class="item" a href="/cart.html">
<i class="fi-shopping-cart"></i>
<div>
<label>Cart</label>
</div>
</a>
<a class="item" a href="/pages/about-us">
<i class="fi-info"></i>
<div>
<label>About</label>
</div>
</a>
<a class="item" a href="/pages/contact-us">
<i class="fi-mail"></i>
<div>
<label>Contact</label>
</div>
</a>
<a class="item" a href="/account/login">
<i class="fi-torso"></i>
<div>
<label>Account</label>
</div>
</a>
</div>
</div>
</div>
I've tried to center the labels with no luck. Has anyone had any issue with this before. Can't post a screenshot since it's a new account. but the contact label and account label seem to start on the left of the icon and go right instead of the start of the actual icon box.
Ok your problems is about CSS in foundation. the property "padding" here:
.icon-bar > * {
font-size: 1rem;
padding: 1.25rem;
}
To fix that, you need to add a media query for mobile. Maybe something like:
#media (max-width: 400px) {
a.item {
padding-left: 0;
padding-right: 0;
position: relative;
text-align: center;
}
}
Change the value 400px of your resolution. If its doesn't work because CSS style is overrite by another.. change padding-left and padding-right for:
padding-left: 0 !important;
padding-right: 0 !important;
Check this JSFiddle

css menu jerkiness

HTML:
<div style="padding-bottom:3px;background:transparent; color:white!important; float:left; margin-right:20px; line-height:42px;">
<span class="linkcontainer">
<a class="hardlink" style="padding:0 10px;" href="http://hronline">HROnline</a>
</span>
<span class="linkcontainer">
<a class="hardlink" style="padding:0 10px; " href="http://hronline/ec">Employee Center</a>
</span>
<span class="linkcontainer">
<a class="hardlink" style="padding:0 10px; " href="http://hronline/businesscommunities">Business Communities</a>
</span>
<span class="linkcontainer">
<a class="hardlink" style="padding:0 10px;" href="http://hronline/internalservices">Internal Services</a>
</span>
<span class="linkcontainer">
<a class="hardlink" style="padding:0 10px;" href="http://hronline/policiesprocedures">Policies&procedures</a>
</span>
<span class="linkcontainer">
<a class="hardlink" style="padding:0 10px;" href="http://hronline/qualitybestpractices">Best Practices</a>
</span>
</div>
CSS:
.hardlink {
color: #FFF !important;
}
.hardlink:hover{
background:url("/_layouts/images/bgximg.png") repeat-x -0px -489px;
background-color:#21374c;
border:1px solid #5badff;
display:inline-block;
line-height:20px;
}
What is causing the whole div jerky behavior on hovering over each link?
You're adding a border on :hover. To fix the issue - just add a transparent border to normal state as well DEMO
.hardlink {
color: #fff !important;
border: 1px solid transparent;
}