How to move a button to center in salesforce lightning component - salesforce-lightning

<aura:component implements="force:lightningQuickAction,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
<H1> <ui:button label="Web to Lead Form" press="{!c.openActionWindow}"/> </H1>
Css
.THIS {
}
H1.THIS {
font-family: 'calibri';
font-size: 18px;
background-color: White;
border: 5px solid white;
padding: 20px 110px;
text-align: center;
}
Here is the snapshot, where i am not able to move the inside button to center

Did you try to flex the host component if that's an option?
.THIS {
display: flex;
justify-content: center;
}

Related

How can I place button tag in centre of a card in material Ui?

There is only one button in the card and I want it to be exactly at the centre from vertical and centre from horizontal.
Actually having no content in my card is making it shrink
.card{height:200px;width:200px}
.card-body {
padding: 1.25rem;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
border:1px solid #ccc
}
.btn {
display: inline-block;
font-weight: 400;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border: 1px solid transparent;
padding: .375rem .75rem;
font-size: 1rem;
line-height: 1.5;
border-radius: .25rem;
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.btn-primary {
color: #fff;
background-color: #007bff;
border-color: #007bff;
}
<div class="card shadow">
<div class="card-body">
<div class="text-center">
Center align
</div>
</div>
</div>
<div>
<button>Submit</button>
</div>
So, suppose this Div is the card and inside it button is the chlid. for making the button horizontally and vertically center just apply display Property Flex, justify-content property Center and align-items property to Center.
And the second issue "having no content in my card is making it shrink", it is because, having no content inside the card means there is no way that it could take some place in the browser as there is no child inside the card. but if you define a height and width to the card you will see that the card is not shirking.

flipping card bug on IOS

i just hosted a small portfolio via github pages, and I tried to use media query to make it work on various device size.
The portfolio section includes these flipping card which i've been told are bogus on IOs devices when using chrome.
In fact it seems the back face are diplayed mirror on the Y axis.
I tried to debug by using CrossBrowser but without success.
Here's the repo with the code,
Here's a link to the bogus section.
Here some code should be enough to reproduce the issue (but i would still suggest to consider the repo code since i could miss something here)
html
<figure class="fig-container">
<div class="card">
<div img class="front face" style="background-image: url('http://img.youtube.com/vi/x10dBwZFi2Q/0.jpg');"></div>
<div class="back face">
<p><b>Location:</b> loc</p>
<p><b class="text-medium-big">Description: </b> desc</p>
</div>
</div>
</figure>
css
figure{
margin-bottom: 0px;
}
.fig-container {
max-width: 450px;
min-height: 160px;
/* horizontal center*/
margin-left: auto;
margin-right: auto;
}
.card {
box-sizing: border-box;
min-height: 250px;
transform-style: preserve-3d;
transition: all 0.5s linear;
border: 2px solid white;
border-radius: 20px;
}
.fig-container:hover .card {
transform: rotateY(180deg);
}
.face {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
border-radius: 17px;
}
.face.front {
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
.face.back {
display: block;
transform: rotateY(180deg);
box-sizing: border-box;
color: white;
font-size: 0.5em;
text-align: justify;
line-height: 1.5;
overflow-y: auto;
}
Anyone is able to see the bug and understand what it could be the problem?

Bypass ionic 2 component and use default html tag

Let's say I want to create a custom button element that extends the default html button tag.
My component would look more or less like this:
#Component({
selector: 'my-button',
styles: []
template: `<button><ng-content></ng-content></button>`
})
export class MyButton{}
The issue is that instead of a regular HTML button, I get the ionic2 button. How can I bypass the ionic 2 button component and create my own?
Have you tried with an anchor element?
<a class="my-button"><ng-content></ng-content></a>
and some default button styles like these (or the styles you want to apply to it):
a.my-button {
align-items: flex-start;
text-align: center;
cursor: default;
color: buttontext;
border-image-source: initial;
border-image-slice: initial;
border-image-width: initial;
border-image-outset: initial;
border-image-repeat: initial;
background-color: buttonface;
box-sizing: border-box;
padding: 2px 6px 3px;
border-width: 2px;
border-style: outset;
border-color: buttonface;
padding: 1px 6px;
text-rendering: auto;
color: initial;
letter-spacing: normal;
word-spacing: normal;
text-transform: none;
text-indent: 0px;
text-shadow: none;
display: inline-block;
text-align: start;
margin: 0em 0em 0em 0em;
font: 13.3333px Arial;
}

I am trying to make CSS work on mobile browsers

My CSS is working perfectly fine on Google Chrome, Mozilla, and Opera. I have also tried Internet Explorer but that was a bust - Not that it matters.
My biggest issue right now is getting my CSS to work correctly on mobile safari (and other smartphone browsers like android).
HTML:
.load-more {
background-color: #00aa00;
color: #ffffff;
display: block;
font-family: 'Numans', sans-serif;
font-weight: lighter;
height: 3em;
line-height: 3em;
overflow: hidden;
padding: 0 3em;
text-align: center;
text-decoration: none;
transition: all .2s ease, background-color .01s ease, color .01s ease;
border-bottom: none;
}
.load-more.load-more--loading {
animation: rotate 1.5s linear infinite;
animation-delay: .2s;
background-color: transparent;
border: .3em solid #e1e1e1;
border-radius: 1.5em;
border-top-color: #00aa00;
box-sizing: border-box;
height: 3em;
color: transparent;
padding: 0;
pointer-events: none;
width: 3em;
-webkit-animation: rotation 2s infinite linear;
}
#-webkit-keyframes rotation {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(359deg);
}
}
<form action="stats.php" method="GET">
<div class="group">
<input type="text" name="player" autocomplete="off"><span class="highlight"></span><span class="bar"></span>
<label>USERNAME</label>
</div>
<center>
<input type="submit" value="CHECK STATS" class="load-more">
</a>
</center>
</form>
The CSS (and a javascript file that I'm using) turn the button into a loader when you click on it, but on mobile browsers like safari the button just disappears when you click it with no loader.
Example: https://epicmc.us
There's some support in iOS 7 and 8 for transform but none for animation in iOS. You're going to have to use jQuery or something to get the effect to work in mobile safari. Caniuse.com tells us the support here for these attributes: http://caniuse.com/#search=transform
This CSS works perfectly on mobile safari...
.load-more {
background-color: #00aa00;
color: #ffffff;
display: block;
font-family: 'Numans', sans-serif;
font-weight: lighter;
height: 3em;
line-height: 3em;
overflow: hidden;
padding: 0 3em;
text-align: center;
text-decoration: none;
border-bottom: none;
}
.load-more.load-more--loading {
background-color: transparent;
border: .3em solid #e1e1e1;
border-radius: 1.5em;
border-top-color: #00aa00;
box-sizing: border-box;
height: 3em;
color: transparent;
padding: 0;
pointer-events: none;
width: 3em;
-webkit-animation: rotation 2s infinite linear;
}
#-webkit-keyframes rotation {
from {-webkit-transform: rotate(0deg);}
to {-webkit-transform: rotate(359deg);}
}

iPhone Vs browser : CSS for right align clear icon in text box

I have seen same kind of issues in stack overflow itself. Still asking it because I am facing the following issue.
I have a textbox which has a clear icon on the right side.
And in the textbox there is a smartfill (autofilling data).
Need this to work fine in desktop browser / iphone browser / or in any mobile browser. !
HTML
<div class="outerWrapper">
<div id="mainContainer">
<label>Smartfill box
<span class="ui-icon-delete"></span>
<input type="text" placeholder="" onkeydown="smartfill()" autocomplete="off" />
<div id="smartFill1" class="smartFillBox">
<li><div>first</div>starts here</li>
<li><div>Second</div>Goes here</li>
<li><div>Third</div>Goes here</li>
<li><div>Fourth</div>Goes here</li>
</div>
</label>
</div>
</div>
CSS
/* Main css --------------------*/
.outerWrapper label input[type="text"], .outerWrapper label input[type="url"], .outerWrapper label input[type="email"], .outerWrapper label input[type="password"], .outerWrapper label input[type="tel"] {
margin-top: 0.3em;
padding: 0;
}
input[type="text"], input[type="url"], input[type="email"], input[type="password"], input[type="tel"] {
-moz-appearance: none;
border: 1px solid #CECECE;
border-radius: 4px 4px 4px 4px;
box-shadow: 0 4px 8px #E1E1E1 inset;
display: block;
font-size: 20px;
margin: 0;
min-height: 40px;
width: 98%;
}
.outerWrapper label {
display: block;
font-size: 16px;
padding-bottom: 7px;
}
#mainContainer {
font-size: 14px;
margin-bottom: 30px;
margin-left: 15px;
margin-right: 15px;
}
/* site css --------------------*/
.ui-icon-delete {
background-attachment: scroll;
background-image: url("http://www.autoweek.com/assets/losangeles/closeButton.png");
background-origin: padding-box;
background-position: 0 50%;
background-repeat: no-repeat;
cursor: pointer;
display: none;
float: right;
height: 29px;
margin: 0 3px;
padding: 0;
position: relative;
right: 0.3%;
top: 36px;
width: 4%;
display: inline;
}
.smartFillBox {
height: 50px;
margin: -1px 0 0;
width: 98%;
display: block;
}
.smartFillBox li {
border-bottom: 1px solid #CECECE;
border-left: 1px solid #CECECE;
border-right: 1px solid #CECECE;
float: left;
list-style: none outside none;
margin: 0;
padding: 0;
position: relative;
width: 100%;
}
JsFiddle link for my issue is here : http://jsfiddle.net/smilyface/ze3sA/
Here is a related link: http://jsfiddle.net/PJZmv/801/
I have 3 elements. 1)input-text-box 2)clear-icon 3)smartfill-div. I am not able to relate these three accordingly! I tried jsfiddle-related-link(given above) still I am getting the same issue. Not able to align correctly.