I have the markup as shown below.
<ion-item-group>
<ion-item>First</ion-item>
<ion-item>Second</ion-item>
<ion-item>Third</ion-item>
</ion-item-group>
<ion-item-group>
<custom-component></custom-component>
<custom-component></custom-component>
</ion-item-group>
#Custom component markup#
<ion-item>Test<ion-item>
The problem is that for the ion-item inside my custom component, the standard bottom border is not drawn. Because in the dom they are inside the custom-component. How can I return the bottom border?
https://stackblitz.com/edit/ionic-7a3ai5?file=app%2Fapp.module.ts. See home component for example
Seems like the problem are these style rules:
ion-item-group .item-md .item-wrapper:last-child .item-inner,
ion-item-group .item-md:last-child .item-inner {
border: 0;
}
ion-item-group .item-ios:last-child .item-inner,
ion-item-group .item-wrapper:last-child .item-ios .item-inner {
border: 0;
}
And they're being applied because each custom-component includes only one item, so each item is the last child of its parent.
One way to solve it would be to manually apply the Ionic default border to each item within your custom component (except the item in the last custom-component, just like Ionic does).
Working demo
custom-component {
/* ------- */
/* Android */
/* ------- */
/* Add the border to each item */
.item-md.item-block .item-inner,
ion-item-group .item-md .item-wrapper:last-child .item-inner,
ion-item-group .item-md:last-child .item-inner {
border-bottom: 1px solid #dedede;
}
/* Remove the border from the last custom component item */
&:last-child {
.item-md .item-wrapper:last-child .item-inner,
.item-md:last-child .item-inner {
border: 0;
}
}
/* --- */
/* iOS */
/* --- */
/* Add the border to each item */
.item-ios.item-block .item-inner,
ion-item-group .item-ios:last-child .item-inner,
ion-item-group .item-wrapper:last-child .item-ios .item-inner {
border-bottom: .55px solid #c8c7cc;
}
/* Remove the border from the last custom component item */
&:last-child {
.item-ios:last-child .item-inner,
.item-wrapper:last-child .item-ios .item-inner {
border: 0;
}
}
}
Related
.App {
text-align: center;
** --amenalBlue: #15426C;
--amenalOrange: #D9A460;**
}
h2,h3{
color: gray;
}
/* common table head style */
.tableHead {
*** background-color: var(--amenalOrange);***
}
.tableHead th {
color: var(--amenalBlue);
font-weight: bold;
}
Table head is not taking custom color which i have added but normal hex code is taking. This is happning in MUI table used inside MUI dialog
In ag-Grid when I change the row background color, it is working fine, but when I select the row, the color doesn't change to the blue color so I can recognize that the row is selected.
I'm using gridOptions.getRowStyle to change the row background color:
gridOptions.getRowStyle = function(params) {
return { background: "#3a3a3a" }
}
The way I would approach it, would be to use the rowClass option in ag-grid.
rowClass: 'my-row'
And then in your css you can define:
.ag-root .my-row:not(.ag-row-selected) {
background-color: #3a3a3a;
}
https://embed.plnkr.co/fTENsl/
Another option, if you want a custom selected color, would be to use this:
.ag-root .my-row {
background-color: #3a3a3a;
}
.ag-root .my-row.ag-row-selected {
background-color: blue;
}
if you want to change style of selected row use class in css
.ag-row-selected {
background-color: black;
color: white ;
border-color: gray;
}
I am trying to change the color of the icon in the selected tab and am really struggling with how to overwrite the variable.
I'm doing the following:
ion-tabs {
--color-selected: #ff7800 !important;
--ion-color-contrast: #ff7800 !important;
}
I figured it out! It looks like --ion-color-contrast stems from the original them that you've applied to the component, in my case "dark". So I actually need to overwrite --ion-color-dark-contrast as follows:
ion-tabs {
--ion-color-dark-contrast: #ff7800 !important;
}
To set a CSS variable for a specific component, add the variable inside of its selector. See Ionic Variables for more information on the component-level variables Ionic provides.
/* Set the color on all ion-button elements */
ion-button {
--color: #222;
}
/* Set the background on an ion-button with the .fancy-button class */
.fancy-button {
--background: #00ff00;
}
In my main menu, I need everything under a specific first level item to have a completely different layout.
In the past I have given a specific item a different wrap like this:
IFSUB = 1
IFSUB {
wrapItemAndSub.cObject = CASE
wrapItemAndSub.cObject {
key.field = uid
default = TEXT
default.value = <li>|</li>
1234 = TEXT
1234.value = <li class="mega">|</li>
}
}
But I need to do something different for level 2, 3, and 4 if they are children of uid 1234. Can I rewrite the above to say "if any pid = 1234 above this one then..."?
Wheres the problem then?
ul li a {
color: green;
}
ul li.mega li a {
color: blue; /* color for second level */
}
ul li.mega li li a {
color: pink; /* color for third level */
}
ul li.mega li li li a {
color: fuchsia; /* color for fourth level */
}
If you look at this page: http://twitter.github.com/bootstrap/components.html
Note the submenu and it's position. Now scroll down - notice how it changes? I assumed they implemented it with the scrollspy plugin but I can't seem to figure out how to do it, all I can do is update which list element has the active class.
Any help would be much appreciated :)
You can find this bit of code in the application.js file, it doesn't look as though it's included in the download. It's available here...funnily enough the header comment reads
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
// IT'S ALL JUST JUNK FOR OUR DOCS!
// ++++++++++++++++++++++++++++++++++++++++++
This is the part that does the heavy lifting I believe...haven't tested it, just stepped through the code in Chrome
// fix sub nav on scroll
var $win = $(window)
, $nav = $('.subnav')
, navTop = $('.subnav').length && $('.subnav').offset().top - 40
, isFixed = 0
processScroll()
$win.on('scroll', processScroll)
function processScroll() {
var i, scrollTop = $win.scrollTop()
if (scrollTop >= navTop && !isFixed) {
isFixed = 1
$nav.addClass('subnav-fixed')
} else if (scrollTop <= navTop && isFixed) {
isFixed = 0
$nav.removeClass('subnav-fixed')
}
}
CCBlackburn's answer is close though its missing the required stylesheet. For posterity I've also included the javascript. Anyway I got it working using the following:
Javascript
// fix sub nav on scroll
var $win = $(window)
, $nav = $('.subnav')
, navTop = $('.subnav').length && $('.subnav').offset().top - 40
, isFixed = 0
processScroll()
// hack sad times - holdover until rewrite for 2.1
$nav.on('click', function () {
if (!isFixed) setTimeout(function () { $win.scrollTop($win.scrollTop() - 47) }, 10)
})
$win.on('scroll', processScroll)
function processScroll() {
var i, scrollTop = $win.scrollTop()
if (scrollTop >= navTop && !isFixed) {
isFixed = 1
$nav.addClass('subnav-fixed')
} else if (scrollTop <= navTop && isFixed) {
isFixed = 0
$nav.removeClass('subnav-fixed')
}
}
Stylesheet
/* Fixed subnav on scroll, but only for 980px and up (sorry IE!) */
#media (min-width: 980px) {
.subnav-fixed {
position: fixed;
top: 40px;
left: 0;
right: 0;
z-index: 1020; /* 10 less than .navbar-fixed to prevent any overlap */
border-color: #d5d5d5;
border-width: 0 0 1px; /* drop the border on the fixed edges */
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(0,0,0,.1);
-moz-box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(0,0,0,.1);
box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(0,0,0,.1);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); /* IE6-9 */
}
.subnav-fixed .nav {
width: 938px;
margin: 0 auto;
padding: 0 1px;
}
.subnav .nav > li:first-child > a,
.subnav .nav > li:first-child > a:hover {
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
}
/* LARGE DESKTOP SCREENS */
#media (min-width: 1210px) {
/* Update subnav container */
.subnav-fixed .nav {
width: 1168px; /* 2px less to account for left/right borders being removed when in fixed mode */
}
}