I would change the style of p-inputSwitch component of Primeng library
I would get something like this:
Here's my code :
<div class="contner">
<div class="toggle-area">
<p>SEARCH BY</p>
<div >
<p class ="toggle-inline">Business group</p>
<div class="toggle-btn toggle-inline">
<p-inputSwitch [(ngModel)]="checked"
onLabel=""
offLabel=""
styleClass="ui-inputswitch"
></p-inputSwitch>
</div>
<p class="toggle-inline">Borrower</p>
</div>
</div>
I started by deleting labels but width changes also and I don't know how to increase it
I started by deleting labels but width changes also and I don't know how to increase it
Override PrimeNG ui-inputswitch class :
.ui-inputswitch {
width: 80px !important;
}
See Plunker
you can replace your div element with following
<p-toggleButton onLabel="Business Group(s)" offLabel="Borrower(s)"
onIcon="fa-toggle-on" offIcon="fa-toggle-off" [(ngModel)]="checked"></p-toggleButton>
Related
Please help me with making a text size bigger with style in the following code.
<div class="hidden-overlay"> MASTER CLASS AIR 2.0 TITANIUM </div>
You can try this by adding a modifier for the class, allowing you to change the font size, respectively, the current font size (%, em, rem), or you can specify a static size for example 20px,
<div class="hidden-overlay hidden-overlay--large-percent"> MASTER CLASS AIR 2.0 TITANIUM </div>
<style>
.hidden-overlay--large-percent{font-size: 150%}
.hidden-overlay--large-rem{font-size: 1.5rem}
.hidden-overlay--large-rem{font-size: 1.5em}
.hidden-overlay--large-px{font-size: 20px}
</style>
for hover effect
<div class="img-wrapper">
<img src="some-img.jpg">
<div class="hidden-overlay <div class="hidden-overlay hidden-overlay--large-percent">MASTER CLASS AIR 2.0 TITANIUM</div>
<div>
<style>
.img-wrapper:hover .hidden-overlay--large-percent{color: blue}
.img-wrapper:hover .hidden-overlay--large-rem{color: #00f}
.img-wrapper:hover .hidden-overlay--large-rem{color: #00f}
.img-wrapper:hover .hidden-overlay--large-px{color: #00f}
</style>
Since you want to do it from style in the div you've provided, you can try this:
<div class="hidden-overlay" style="font-size: 20px;"> MASTER CLASS AIR 2.0 TITANIUM </div>
style attribute is added to div in which you can write regular css code.
If you want to apply to several places in HTML then you'll have to use CSS classes.
You can try something like this:
<div style="font-size:40">(insert your text here)</div>
You can change the size instead of the "40" as you want.
One solution is to simply set the font size for everything in the div like so:
<div class="hidden-overlay" style="font-size: 3em;"> MASTER CLASS AIR 2.0 TITANIUM </div>
A nicer way of doing it would be to make the text a heading by nesting it in an h1 (maybe try and h2 or h3 aswell)
<div class="hidden-overlay"><h1>MASTER CLASS AIR 2.0 TITANIUM</h1></div>
see a live sample here.
Extra Note: If you didn't want this css to be inline instead of style="font-size: 3em;" you could just apply this css to the class hidden-overlay like so:
<style>
.hidden-overlay {
font-size: 2em;
}
</style>
I have a Squarespace site that has a div that has align-center-vert and I was trying to override it to align-top-vert but can't figure out how to do it.
I have been trying to inject code on Squarespace to override the class like so:
<style>
.align-center-vert {
position: top!important;
}
</style>
But this doesn't seem to work.
The full div doesnt have an ID either which makes it hard.
<div class="sqs-slice-group group-copy align-center-vert full-width">
<div class="sqs-slice" data-slice-type="heading" data-slice-id="5b018c461ae6cf341dcc163e" data-content-empty="true"></div>
<div class="sqs-slice" data-slice-type="body" data-slice-id="5b018c461ae6cf341dcc163f" data-content-empty="true"></div>
<div class="responsive-wrapper actions" style="display: inline-block;">
<div class="sqs-slice" data-slice-type="custom-form" data-content-empty="true"></div><div class="sqs-slice yui3-widget sqs-slice-navigation sqs-slice-navigation-content sqs-slice-navigation-focused" data-slice-type="navigation" data-compound-type="action" data-slice-id="5b018c461ae6cf341dcc1642" id="yui_3_17_2_1_1526841597381_309"><ul id="yui_3_17_2_1_1526841597381_382"><li id="yui_3_17_2_1_1526841597381_381">Archive</li><li>Shop</li></ul></div>
</div>
</div>
There is no position: top setting in CSS. If you want to override a vertical-align setting, use vertical-align: top
Currently I'm using the progressbar of ng2-bootstrap in the GUI of my website. The HTML which I use for this step is very simple:
<div class="col-lg-8 col-md-4">
<progressbar max="100" class="progress-striped" [value]="progress">{{progress}}%</progressbar>
</div>
This gets rendered into the following HTML:
<div class="col-lg-8 col-md-4">
<progressbar class="progress-striped" max="100">
<div progress="" max="100" class="progress" style="height: 30px;">
<bar>
<div aria-valuemin="0" class="progress-bar" role="progressbar" style="min-width: 0px; width: 0%;" ng-reflect-initial-classes="progress-bar" aria-valuenow="0" aria-valuetext="0%">
0%
</div>
</bar>
</div>
</progressbar>
</div>
I removed some angular directives to improve the readability
The height of the progressbar is set in the second div within the css-class progress, which I can not access, because it is set in the provided source code of the component. Also the innermost div is the one I would need to access if I want to change the font-size.
I tried to override the style in the parent to set the height, but the progress class is more specific and therefore I could not override it.
I found a not very pretty solution which uses ElementRef and Renderer, but this scales very bad and will get messy if there are multiple progressbars(ATM I'm trying to access a second progressbar):
ngAfterViewInit() {
this.renderer.setElementStyle(this.el.nativeElement.querySelector('progressbar').querySelector('div'), 'height', '30px');
this.renderer.setElementStyle(this.el.nativeElement.querySelector('progressbar').querySelector('div').querySelector('bar').querySelector('div'), 'font-size', '15px');
}
Are there better approaches to solve this problem? As last resort I could try to adjust the source code of the component to access both values, but actually I want to avoid this.
You mention specificity as the problem. If that's the case, using !important is a solution. Anything marked with !important will gain top-specificity and cannot be overridden by any other non-!important CSS rule or inline styles.
When put in your global.css file this should work for all progressbars.
It might not work from within your component.css due to view encapsulation.
progressbar > div[progress] {
height: 30px !important;
}
progressbar > div[progress] > bar > .progress-bar {
font-size: 15px !important;
}
I am a CSS newbie and I have to change some code where it looks like they are inheriting styles from bootstap..
<style>
.thumbnail{display:table !important}
</style>
<div class="thumbnail">
So thumbnail is a cell inside a table and I need to change the height and weight of this cell, any suggestions on how I can do that? I am not seeing any height or width attributes for that style?
Thanks.
Do not modify bootstrap classes just add new class like this
CSS
.thumbnail-custom{
background-color:red !important;
}
I think even !important is not needed
HTML
<div class="thumbnail thumbnail-custom">
...
</div>
If you are using LESS
.thumbnail-custom{
.thumbnail;
background-color:red !important;
}
And HTML
<div class="thumbnail-custom">
...
</div>
I am trying to create a bootstrap accordion for my app. I also have background color in its parent element. My problem is that when I expand my accordions, it extends the height of my page and the background color doesn't cover the extended area.
my html
<div id='wrapper>
<accordion id='accordion' close-others="false">
<accordion-group>
<accordion-heading >
<h2 class='title'>Title 1</h2>
</accordion-heading>
<div id="first" class="panel-collapse collapse in">
//contents...
</div>
</accordion-group>
//I have 5 to 6 accordion group.
</accordion>
</div>
CSS:
//I used height:100% and it looks fine when the page first loaded but not after //user //expand all the accordion.
#wrapper{
background-color: red;
height: 100%;
display: block;
}
Can anyone help me about it? Thanks a lot!
Looking through the documentation I noticed you could catch the event shown.bs.collapse which
is fired when a collapse element has been made visible to the user
(will wait for CSS transitions to complete).
So you could try something like:
$('#myCollapsible').on('shown.bs.collapse', function () {
document.getElementById('wrapper').style.backgroundColor="red";
})
Edit: if that does not work try show.bs.collapse