Weird margin Angular2 custom component (Ionic2) - css

Since I'm using Ionic2 RC0 and Angular2 Final, when I create custom components, those components creates a margin and I don#t know how to remove it and if this is a Ionic or Angular problem. That is the first time I'm having this issue, before the update was not like that (I guess).
See image:
The custom component is the one with black border it's just a wrapper and has no style. There are also no margins and no paddings.
Any idea what is going on?

Related

Angular Material with other CSS Framework

I'm about to start my first Angular project, and I'm thinking about using Angular Material.
It has a lot of components which is what i'm looking for but it seems to me that it does not have a grid system nor any utility classes.
Should I use for example Bootstrap or any other css framework along with Angular Material or simply add my own css? What's the common practice?
Having to add classes for padding, margin and so on is a waste of time so I'd be inclined to also use Bootstrap which already has all these kind of classes.
My only fear is that having both Angular Material and Bootstrap would increase the bundle significantly.
I am using the following for my project
For grid, checkout this https://www.ag-grid.com/angular-grid/.
For
angular wrapper of bootstrap you can check
https://valor-software.com/ngx-bootstrap/#/documentation#getting-started
You may also want to check
https://primefaces.org/primeng/showcase/#/setup this has UI
components as well as their own spacing and grid setup
https://primefaces.org/primeng/showcase/#/primeflex/spacing

Out of the box responsive images with Google Polymer?

I just started working with Polymer and their starter kit. I want to have a standard hero image with a text overlay - naturally, I want the image to be responsive. I've gone through all the Iron and Paper elements and can't seem to find anything that works.
I've tried using the Iron image, Flex layout, and Media queries in various compbinations to get what I need, but to no avail. I've found several 3rd party components like x-imager that will do the trick, but I would've thought such basic functionality would be available right out of the box like it is with pretty much every "responsive" framework - and yes, while I know Polymer isn't supposed to be a framework, I guess I expected it to be part of their component library. And yes, I also know I can create a simple CSS class that does that like Bootstrap does too, but I'm looking for native functionality, out of the box here.
Is there something I'm missing here or should I just create a custom component and move on?

What is the best way to customize Bootstrap

I am now having a lot of troubles with Bootstrap. I used to use it to build a website once and then I have never used it again. But now, I have to use it. I downloaded the compressed version and include JS and CSS file in my project.
Here is the problem. I don't know how to customize it effective. For example, I create a navbar that is much higher (height:90px;) than the bootstrap default navbar. Hence, I have to modify the padding of the navigation panel on the navbar and when the navbar is collapsed, the items in this collapsible navbar are aligned incorrectly due to the padding and margin modification for the large screen.
I have one solution in my mind. May be I have to modify the media query padding and margin or if you have other effective ways to do it. Please tell me.
Create a file with overrides that you load after the bootstrap file. The override file will redefine the bootstrap classes you want to change. It's important that you load the override file after the bootstrap file.
Just linking Your own CSS file, and insert your custom class to the element. And then styling your custom class & avoid to override default class provided by bootstrap itself. This is my practice when using bootstrap or another CSS Framework.
Never have problem so far. Good luck for your project.

Dynamically change background-color

I want to change the background color of my Vaadin app on the valueChange event of a OptionGroup component.
As there are a fairly big number of layouts on my page, what would be the best is to change every HorizontalLayout and VerticalLayout background-color, but every new component that could be added should have this color too.
How can I achieve that? Thanks.
Two approaches come to mind.
The simplest, conceptually, as well as in terms of implementation, would be to have a single component to serve as the background, and give your HorizontalLayout and VerticalLayout components a transparent background. If you're layout is too complex for this, you can have a number of base 'background' components, again, with your layout components on top being transparent. The idea is to reduce the components whose color you need to change to something manageable.
If that approach doesn't translate to your use case, you can always use JavaScript to select the layout components on the fly and redefine their background. This could be made more manageable by giving all the layout components a common CSS class (eg: 'dynamic-background').
JavaScript.getCurrent().execute("$('.dynamic-background').css('background-color', 'purple')");
Note that this JavaScript depends on JQuery, have a look around for more details on integrating JQuery with Vaadin:
Add javascript/Jquery & client side code in Vaadin 7
Integrating HTML and JavaScript in Vaadin 7

CSS is not applied correctly when using Backbone.Marionette region

I'm new to Backbone.Marionette and now I'm developing my first app with this framework.
The problem that I'm struggling now: css is not applied correctly when I'm using regions with my views. To be more specific: I have a CompositeView which renders a slider with pictures (using roundabout jQuery plugin). Everything was fine until I've tried to use it with region.
I added a region { sliderContainer: "#sliderContainer"} to my application and than called show(view) on it. Now it is not rendered correctly (I guess, the styles which were defined on the root view div element with id="greatSlider" are not applied). I thought that problem is in extra div that I added for region, but after I removed the region, and made sliderContainer an el of my view also moving greatSlider to the template, I got everything working ok again. Any thoughts how to deal with this?
Was my mistake in selector no problems with regions anymore.

Resources