I have a simple grid but the problem is its showing too much space on top of images.
html
<ion-grid style="height: 100%">
<ion-row class="ion-align-items-center ion-justify-content-center">
<ion-col size="6" *ngFor="let x of data" >
<ion-card class="card-img" (click)="detail()">
<img src="../../assets/img/demo.jpg" >
<div style="text-align: center;" class="boxe">
<ion-icon name="checkmark" class="tick" color="medium"></ion-icon>
<ion-icon name="close" class="cross" color="dark"></ion-icon>
</div>
</ion-card>
</ion-col>
</ion-row>
</ion-grid>
scss
.card-img{
border-radius: 10px;
}
.tick{
text-align:center;
font-size: 30px;
}
.cross{
text-align:center;
font-size: 30px;
}
ion-card{
margin: 0px
img{
width:100%;
}
}
.no-shadow{
box-shadow: none !important;
}
ion-row{
ion-card{
width:100% !important;
margin-left: 0 !important;
margin-right: 0 !important;
matgin-top: 0 !important;
img{
width:100%;
}
}
}
As you can see in image i add black lines on space i need to remove this space or add little space like 4 5px.
You just need to remove margin top and the bottom on ion-card.
Change this to:
ion-row{
ion-card{
width:100% !important;
margin-left: 0 !important;
margin-right: 0 !important;
matgin-top: 0 !important;
img{
width:100%;
}
}
This:
ion-row{
ion-card{
width:100% !important;
margin: 0 !important; // I also dont think important is neccesary
img{
width:100%;
}
}
Related
I have an email that I'm working on that included a light-colored background image with black text and a button over it. On MS-Outlook Dark Mode (macOS 10.15) and Outlook.com Dark (Chrome), the text and button are white. Here's my code.
I followed advice from this article: and have added the fixes recommended in the section How to Keep Text Black Inside VML in Dark Mode, but the text is still white. Any ideas?
<!DOCTYPE html>
<html lang="en">
<head>
<title>NielsenIQ Consumer 360</title>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
<meta name="color-scheme" content="light dark">
<meta name="supported-color-scheme" content="light dark">
<!--[if mso]><xml>
<o:OfficeDocumentSettings>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if mso]>
<style type="text/css">
body, table, td, h1, h2, h3, p, li, a {font-family: Helvetica, Arial, sans-serif !important;}
</style>
<![endif]-->
<style>
/* CLIENT-SPECIFIC STYLES */
body, table, td, a { -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
table, td { mso-table-lspace: 0pt; mso-table-rspace: 0pt; font-size:0; line-height: 0; }
img { -ms-interpolation-mode: bicubic; }
/* RESET STYLES */
img { border: 0; height: auto; line-height: 100%; outline: none; text-decoration: none; }
table { border-collapse: collapse !important; font-size: 0; line-height: 0; }
body { height: 100% !important; margin: 0 !important; padding: 0 !important; width: 100% !important; }
/* iOS BLUE LINKS */
a[x-apple-data-detectors] {
color: inherit !important;
text-decoration: none !important;
font-size: inherit !important;
font-family: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
}
/* GMAIL BLUE LINKS */
u ~ div #body-table a {
color: inherit;
text-decoration: none;
font-size: inherit;
font-family: inherit;
font-weight: inherit;
line-height: inherit;
}
/* SAMSUNG MAIL BLUE LINKS */
#MessageViewBody a {
color: inherit;
text-decoration: none;
font-size: inherit;
font-family: inherit;
font-weight: inherit;
line-height: inherit;
}
a {text-decoration: none;} /* for Windows 10 underlining */
body[yahoo]{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
table { border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0;empty-cells:show; }
:root {
color-scheme: light dark;
supported-color-schemes: light dark;
}
/* Make sure the links are Black in Gmail */
.link { text-decoration: underline; color: #000000 !important; }
.link:hover { text-decoration: none; }
/* Target Outlook App for Dark Mode */
/* Shows Dark Mode-Only Content, Like Images */
[data-ogsc] .dark-img { display:block !important; width: auto !important; overflow: visible !important; float: none !important; max-height:inherit !important; max-width:inherit !important; line-height: auto !important; margin-top:0px !important; visibility:inherit !important; }
/* Hides Light Mode-Only Content, Like Images */
[data-ogsc] .light-img { display:none; display:none !important; }
/* Styles for Dark Mode */
#media (prefers-color-scheme: dark ) {
/* Shows Dark Mode-Only Content, Like Images */
.dark-img { display:block !important; width: auto !important; overflow: visible !important; float: none !important; max-height:inherit !important; max-width:inherit !important; line-height: auto !important; margin-top:0px !important; visibility:inherit !important; }
h1.black-header1, p.black-para, .inner a { color: #000000 !important; }
.keep-black { color: #000000 !important; }
/* .two-column__white-bg-left-img .two-column,
.two-column__black-bg-right-img .two-column,
.wrapper { background-image: none !important; } */
/* Hides Light Mode-Only Content, Like Images */
.light-img { display:none; display:none !important; }
}
#import url('https://fonts.googleapis.com/css2?family=Montserrat:wght#400;500;700&display=swap');
.wrapper { width: 640px; background-color: #fefefe; }
div.left-column td.inner,
div.right-column td.inner { padding-top: 20px; }
.niq-top { width: 100%; }
.niq-angle { width: 100%; }
.top-story { padding-left: 60px; padding-top: 20px; padding-right: 60px; padding-bottom: 60px; }
.hero-image { width: 100%; max-width: 100%; }
.dark-gray-cat-left { font-family:'Montserrat', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #666666; font-weight: 700; }
.divider { width: 640px; height: 12px; }
.social-section, .copyright-section { padding-left: 60px; padding-top: 60px; padding-bottom: 60px; padding-right: 60px; }
.branding-section { padding-left: 60px; padding-top: 20px; padding-bottom: 20px; padding-right: 60px; width: 640px; }
.footer-section { padding-left: 60px; padding-top: 60px; padding-right: 60px; padding-bottom: 80px; }
img.bottom-logo { width: 196px; height: auto; }
a.black-link { color:#000000; }
a.white-link { color:#ffffff; }
/*C360 Styles */
.inner { padding-left: 60px; padding-top: 20px; padding-right: 60px; padding-bottom: 30px; }
/*Media Queries*/
#media screen and (max-width: 480px) {
.wrapper { width: 480px; }
.niq-top { width: 100%; }
.niq-top img { width: 480px; height: auto; }
.niq-angle img { width: 480px; height: auto; }
.top-story { padding-left: 40px; padding-top: 20px; padding-right: 40px; padding-bottom: 40px; }
.branding-section { width: 480px; }
.divider { width: 480px; height: 6px; }
.social-section, .copyright-section { padding-left: 40px; padding-top: 40px; padding-right: 40px; padding-bottom: 40px; }
.footer-section { padding-left: 40px; padding-top: 40px; padding-right: 40px; padding-bottom: 60px; }
}
</style>
<!--[if gte mso 16]>
<style>
body {
background-color:#353535 !important;
}
.keep-black {
mso-style-textfill-type:gradient;
mso-style-textfill-fill-gradientfill-stoplist:"0 \#000000 1 100000\,99000 \#000000 1 100000";
color: #ffffff !important;
mso-color-alt: auto;
}
</style>
<![endif]-->
</head>
<body style="background-color: #b3b3b3;">
<!-- Top Section Header / 0- ===== Only this top portion expands 100% width across the top ===== -->
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="background-color: #010101;" width="100%">
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td align="center" class="niq-top" style="background-color: #010101;font-size:0;line-height:0;"><img alt="NielsenIQ" src="https://microsites.nielsen.com/web-assets/wp-content/uploads/sites/10/2021/01/the-iq-brief-top-bar-no-N.png"></td>
</tr>
</table>
</td>
</tr>
</table>
<!-- End Top Section -->
<!-- Main Content Area -->
<table align="center" border="0" cellpadding="0" cellspacing="0" class="wrapper" role="presenation" style="background-color: #fefefe;">
<tr>
<td><!-- Top Story Block -->
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation">
<tr>
<td align="center"><!-- Top Story -->
<table border="0" cellpadding="0" cellspacing="0" class="wrapper" role="presentation" style="width: 640px;">
<tr>
<td class="lead-in" style="background-image: url('https://microsites.nielseniq.com/web-assets/wp-content/uploads/sites/7/2022/03/white-background-1.png'); background-color: #ffffff; background-position:top left; background-repeat: no-repeat;">
<!--[if gte mso 9]>
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" fillcolor="#fefefe" style="width: 640px; height: 317px;">
<v:fill type="tile" type="frame" src="https://microsites.nielseniq.com/web-assets/wp-content/uploads/sites/7/2022/03/white-background-1.png" color="#656565" />
<v:textbox style="mso-fit-shape-to-text:true" inset="0,0,0,0">
<![endif]-->
<div>
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%">
<tr>
<td class="inner">
<h1 class="keep-black" style="font-family:'Montserrat', Helvetica, Arial, sans-serif; font-size: 28px; line-height: 38px; color: #000000; mso-color-alt:auto;font-weight: 700;">Gain the momentum to tackle what's next</h1>
<p class="keep-black" style="font-family: 'Montserrat', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; color: #000000; mso-color-alt:auto;">Explore ideas that are motivating progress and transforming the consumer packaged goods industry.</p>
<!--[if mso]><i style="letter-spacing: 12px;mso-font-width:-100%;mso-text-raise:32pt"> </i><![endif]--><span style="mso-text-raise:12pt;color:#ffffff;">Join us at C360 2022</span><!--[if mso]><i style="letter-spacing: 12px;mso-font-width:-100%"> </i><![endif]-->
</td>
</tr>
</table>
</div>
<!--[if gte mso 9]>
</v:textbox>
</v:rect>
<![endif]-->
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
I am struggling with getting styling correct. I think it is related to hierarchy of styling of the various ionic tags, but I am unsure.
In my app, I am trying to center some <ion-button> tags inside of columns of an <ion-grid>.
The result I keep getting is left-aligned buttons like this:
I have tried a variety of styles and classes to center the buttons. I have tried them at every level of the hierarchy (at the ion-item, grid, row, col, label, buttons, button levels), but I keep getting the same result.
Here is the structure of the item. In this iteration, you can see that I was trying to use the text-center attribute at the level of the row:
<ion-item>
<ion-grid>
<ion-row text-center>
<ion-col size="6">
<ion-label>
<ion-buttons>
<ion-button> Problem? </ion-button>
</ion-buttons>
</ion-label>
</ion-col>
<ion-col size="6">
<ion-label>
<ion-buttons>
<ion-button>More</ion-button>
</ion-buttons>
</ion-label>
</ion-col>
</ion-row>
</ion-grid>
</ion-item>
I've read the ionic documentation on the scss styling, but they don't discuss nested items like a grid inside of an ion-item.
I suspect that some element's styling is over-riding my attempt to center the buttons here and I need to understand the basic principle of styling hierarchy. Is there a place to go to learn this?
I've included the entire .scss file for reference, but I suspect I'm missing a principle:
.ios,
.md {
page-home {
#container {
text-align: left;
position: absolute;
left: 0;
right: 0;
top: 50%;
transform: translateY(-50%);
}
#container strong {
font-size: 20px;
line-height: 26px;
}
#container p {
font-size: 16px;
line-height: 22px;
color: #8c8c8c;
margin: 0;
}
#container a {
text-decoration: none;
}
ion-item {
padding-top: 0.5rem;
}
.center-button {
position: relative;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-item: center;
}
ion-col {
text-align: left;
}
ion-label {
font-weight: bold;
}
ion-title {
font-size: 1.5rem;
}
.item-name {
font-size: 2rem;
}
}
}
Thanks!
You can achieve this by adding these two css properties to ion-label
display: flex;
justify-content: center;
This cannot be the right way to solve the problem, but this is what I eventually did: I just put the styling information inline in the HTML. Here's an example:
<ion-row style="width: 100%; text-align: center">
<ion-item style="width: 100%; text-align: center">
<ion-col size="4" style="align-content: center">
<ion-buttons style="width: 100%; text-align: center">
<ion-button
style="width: 100%; text-align: center"
(click)="onClickProblem('button', item.name)"
>
Problem?
</ion-button>
</ion-buttons>
</ion-col>
<ion-col
size="4"
style="width: 100%; text-align: center"
*ngIf="item.notes"
>
<ion-buttons style="width: 100%; text-align: center">
<ion-button
style="width: 100%; text-align: center"
(click)="onClickMore('button', item.notes)"
>More</ion-button
>
</ion-buttons>
</ion-col>
You can see the "width: 100%; text-align: center" throughout. It is not the most maintainable solution, but it got me out of the purgatory of no progress.
I want to change ion-label color inside an ion-item with ion-input when focused.
I am able to change the highlight color of ion-item using --highlight-color-focused: yellow; but unable to change the label color.
It is showing default color of label as primary but I want to change it as 'warning' or if required any custom color.
I've tried the following solution which is mentioned in Ionic github repository for same problem but didn't get my problem solved.
https://github.com/ionic-team/ionic/issues/18531
Following code I have used
login.page.html
<ion-content>
<div class="logo">
<div class="logoCenter">
<ion-icon name="sync"></ion-icon>
</div>
<h1 style="font-family: ProximaBold; color: white">Sample Application</h1>
</div>
<ion-grid style="margin-top: 10vh;">
<ion-row>
<ion-col size="12">
<ion-item>
<ion-label class="loginLabel" position="floating">Mobile No.</ion-label>
<ion-input type="number"></ion-input>
</ion-item>
<ion-item>
<ion-label class="loginLabel" position="floating">Password</ion-label>
<ion-input type="password"></ion-input>
</ion-item>
</ion-col>
</ion-row>
</ion-grid>
<ion-grid class="ion-padding">
<ion-row>
<ion-col class="ion-text-center" size="12">
<ion-button expand="full" shape="round" [routerLink]="['/home']">Submit</ion-button>
<p style="color: white;">Forgot Password?</p>
</ion-col>
</ion-row>
</ion-grid>
<p class="registerText">New Here? SIGN UP!</p>
</ion-content>
login.page.scss
ion-content {
--background: linear-gradient(180deg, #2ecc71, #289c59, #1a743f);
.logo {
margin-top: 20%;
text-align: center;
}
.logoCenter {
margin: 0 auto;
height: 150px;
width: 150px;
border-radius: 50%;
background: linear-gradient(290deg, #31da79, #29b866);
box-shadow: 20px 20px 60px #27ad60, -20px -20px 60px #35eb82;
display: flex;
justify-content: center;
align-items: center;
ion-icon {
zoom: 4;
color: white;
animation: rotating 2s linear infinite;
}
}
ion-item {
--background: transparent;
--border-color: white;
--color: white;
--highlight-color-focused: yellow;
}
ion-button {
--background: white;
--color: green;
}
.registerText {
position: absolute;
bottom: 0;
left: 50%;
transform: translate(-50%, 0);
color: white;
font-size: larger;
}
}
#keyframes rotating {
from{
-webkit-transform: rotate(0deg);
}
to{
-webkit-transform: rotate(360deg);
}
}
add this in your page.scss
ion-item.item-has-focus > ion-label{
color: red !important;
}
ion-item
But because of material encapsulation "--color-activated" wont work properly. The easiest way is to target ion-label directly with !important.
This is my default ion-item "scss" file.
.ion-item{
--ripple-color: transparent;
&.item-has-focus ion-label {
color: gray !important;
}
ion-input {
--padding-bottom: 0 !important;
--padding-top: 0 !important;
}
}
Just add !important to your color it will stay focus on which color you have added
ion-label {
color: #fff !important;
}
I am seeing some very odd behavior of my ion-input field when i click inside of it. I have pinpointed it (and not sure why) to the padding-top in the parent div. I also noticed that if I scale back the text to a few words in the p. Any thoughts as to why this is happening or how i can fix it?
.main
.main {
margin: 0 auto;
padding-left: 24px;
padding-right: 24px;
padding-top: 100px; // IF I REMOVE THIS, IT IS NORMAL
&.no-nav {
padding-top: 0px;
}
&.no-content {
:before {
content: '';
position: absolute;
height: 1px;
width: calc(100% - 48px);
border-bottom: 1px solid $surface-03;
top: 96px;
left: 24px;
}
}
&.top-nav {
padding-top: 24px;
}
}
template code
<ion-content>
<div class="main">
<ion-card>
<ion-card-content>
<p>a bunch of text here that seems to push the input box in click down, if i only put a few words here it doesn't behave like this which is odd</p>
<form [formGroup]="" novalidate>
<ion-item>
<ion-input
formControlName=""
required
inputmode="text"
placeholder="Click in me"
></ion-input>
<ion-icon class="edit-icon"></ion-icon>
</ion-item>
</form>
</ion-card-content>
</ion-card>
</div>
</ion-content>
Here is the behavior
I'm creating an html esignature. Despite the same styles being applied to all of the text there is still ONE line of text the the iPhone keeps enlarging. I've read that -webikit-text-size-adjust: none; should prevent this but it is not working. Here is my code for this particular table cell.
<td valign="bottom" class="tag" style="display: block; width: 280px; height: 18px; padding-right: 6px; padding-top: 2px; text-align: right;">
<a style="font-family: Arial; font-size: 11px; line-height: 20px; font-weight: 500; color:#585859; white-space: nowrap; -webkit-text-size-adjust: none;">branding <span style="color: #db1e17;">|</span> communications <span style="color: #db1e17;">|</span> interactive</a>
</td>
In my media query above specifically for iPhone my code is this:
#media screen and (max-device-width: 480px) and (max-device-height: 320px), screen and (max-device-width: 320px) and (max-device-height: 480px){
td.tag {
width: 136px !important;
height: 7px !important;
padding-top: 2px !important;
padding-right: 3px !important;
}
td.tag a{
font-size: 5px !important;
line-height: 9px !important;
-webkit-text-size-adjust: none;}
Can you see what I could be doing wrong?
I would put this outside of the media query.
div, p, a, li, td { -webkit-text-size-adjust:none; }
All you are doing at this point is telling the phone to never set the minimum font-size for all elements.