How to customize Angular Material Card for mobile - css

So I have the following desktop layout (which I am completely satisfied with):
This is my attempt to make it mobile:
I like the horizontal scroll here, but I feel that the cards are too thin; I would like to stretch my card to be more box-like (square). Ideally, the card is big enough to fill the gap between the header and the footer without causing
HTML:
<div class="page-content">
<div class="card-deck" fxLayout.xs="row" style="overflow: scroll; height:100%">
<md-card style="width:10rem;" *ngFor="let make of filteredMakes" (click)="goToModels(make.niceName)"
class="page-card mat-card">
<img md-card-image="" src="assets/img/gallery/brands/256/{{make.name}}.png" class="mat-card-image" />
<md-card-subtitle class="mat-card-title text-center">{{ make.name }}</md-card-subtitle>
</md-card>
</div>
</div>
I've tried many css tricks and tried using flexbox, but there must be something I'm missing (media queries perhaps, and how to override them).
How can I make the following styles apply ONLY to mobile?
min-height: 375px;min-width: 278px;
If anyone has any direction on how to accomplish this design, it would be greatly appreciated.

In order to get a different style for mobile, we do this:
#media (max-width: 600px) {
md-card {
min-width:17rem;
}
}

Related

move div up on mobile using push and pull bootstrap

I am trying yo move neweyes class using push and pull on mobile screen but I am unable to do that. How can I move upside this on mobile screen?
<div>
<div class="woke-eye col-sm-12 col-md-4 col-sm-push-12">
<img id="dani1">
</div>
<div class="neweyese col-sm-12 col-md-8 col-sm-pull-12">
<img src=''/>
</div>
EDIT working fiddle
JSfiddle the wokeup eyes div should come later on mobile. now code is doing reverse , on large screen its coming later . but I need on mobile
Here's an example using your code, but modified so that it works the way you want.
<div>
<div class="neweyese col-md-4 col-md-push-8">
<img src=''/>neweyese
</div>
<div class="woke-eye col-md-8 col-md-pull-4">
<img id="dani1">woke-eye
</div>
</div>
You don't need col-sm-12, because that is the default behavior if you don't include it. Otherwise, we're essentially reversing the position of the two columns on MD and up. If the viewport is below MD, then the columns will switch to a width of 12 but since they are reversed the one on the right will be on top.
https://jsfiddle.net/6rtwyazq/12/
If I understand what you want:
You want on desktop .woke-eye to be on left side and .neweyese on right, on small screen you want .woke-eye to be below .neweyese, If so here is an updated JSfiddle, hope this helps.
Update
Check the updated JSfiddle.
Second Update
Reffering to your last comment, this is what you are looking for JSfiddle.
The following code worked for me.
#media only screen and (max-width: 767px) {
.xs-column-reverse {
display: flex;
flex-direction: column-reverse;
}
}

Responsive Design - Image Sizing

I'm working on a site that uses Bootstrap. I'm working to make this site work on both desktop and mobile browsers. Everything's working except for my banner image size.
I have an image that is 640x480. I have an image defined like this:
<img alt="My Picture" src="/wwwroot/img/banner.jpg" style="height: auto; max-height:320px; max-width: 100%;" />
On mobile pages, the image looks just like I want. However, on the desktop, the image is only 320px wide. However, on the desktop, I want the image to go as wide as it can go. Basically, I want to crop the right portion.
Is there a way to do this with CSS?
Thanks!
Stick your CSS in a class.
If using HTML5 remove the superfluous /
Change your max- to min- regards height.
Change your standard width: to auto, changing you
CSS:
.imageFun {
height: auto;
min-height:320px;
width:100%;
/* this is actually no longer needed but kept for posterity */
max-width: 100%;
}
HTML:
<img alt="My Picture" src="/wwwroot/img/banner.jpg" class="imageFun">
Use a media query to target the img in css file:
#media only screen and (min-width : 320px) {
img {
width:100%!important;
}
}
That should work changing the min-width to your desktop size.
More info here
on twitter-bootstrap you can use div with class responsive width :
<div class="col-md-12 col-sm-12 col-xs-12">
<img alt="My Picture"
src="/wwwroot/img/banner.jpg"
style="height: auto; width: 100%;"
/>
</div>
Where value 12 is width scala on grid bootstap. Please look at : https://getbootstrap.com/examples/grid/
i hope it what U want
You are using Booststrap, so remove the inline styling and add
class="img-responsive col-xs-12
That will fix it.

change menu float when site gets narrow (responsive)

I have a site at www. structuredata. com
when the site is on a desktop it looks great. However when it starts to get narrow, the red 'register' button starts to overlap the menu,
I'd like to make a media query in my css that will force the button to drop down below the navigation when viewed on smaller screens. How would I do that?
the header is setup as
<div id="header_main">
<div class="container">
<div class="inner-container">
<strong class="logo"></strong>
<nav class="main_menu"></nav>
<div id="text-8" class="widget"> BUTTON IS HERE </div>
</div>
</div>
</div>
I tried setting my .header_main.widget
to a display:block and inline-block but neither worked. I tried clear:both on it as well.
Media queries can be tricky, you can read a lot about them here(w3c) and here(mdn)
In your case the media query will look something like so:
#media screen and (max-width:320px) {
#header_main .container .inner-container .widget {
/*Styles go here*/
}
}
Hope this helps!
Your navigation bar and your button are on a different z-index, so that's going to be tricky. That's also why clear did not work.
You could set up a media query to adjust the top position of the button (being that it is relatively positioned), like so:
#media screen and (max-width: 700px) /*Or whenever the button overlaps*/ {
#header .widget .avia-button-wrap {
top: 50px !important;
}
}
But then you'll probably have to adjust some other elements in your header to make everything look okay. But this should get you started!

How to prevent overlapping of two divs?

I have a page, when i am looking this page on a laptop screen the two divs are rendering properly but when i am looking this page on mobile screen these two divs are overlapping above each other. I want to remove this overlapping of these divs and want to read first div then second div.
How to do that ?
#media only screen and (max-width:768px){
.vc_row-fluid.lighter-overlay,
.vc_row-fluid.darker-overlay{
display:inline-block; /* Change this to inline-block instead of block */
}
}
but this is creating issue for header,solve that accordingly
check out with Bootstrap. it provides with responsive CSS. you have to include the div class that you require.
example: if you have two divs, put them into one main div and then call each div with separate div class. like
<div class="col-sm-12">
<div class="col-sm-6">
// your code for first div
</div>
<div class="col-sm-6">
//your code for second div
</div>
</div>
try like this. it may help you.
I hope i understand your question because its not really clear(No code provided)
But what i think you need to do is the following:
<!-- Probably your html part -->
<div class = "wrapper">
<div class = "container">
<!-- Some content-->
</div>
<div class = "container">
<!-- Some content-->
</div>
</div>
Here comes the css magic.....
.wrapper{
display:block;
}
.container{
display: inline-block;
}
#media only screen and (max-width:768px){
.container{
width:100%;
}
}
#media only screen and (min-width:768px){
.container{
width:50%;
}
}
By using media querys you can easily fix this kind of stuff
You added as a comment to your question that a demo URL was http://voyagecontrol.com/canarywharf
Origin of the problem: #venue_draft has inline styles including height: 900px.
Solution: it should be removed (elements should adapt automatically to more or less content. Not fixing height is a good start for that) or, if other problems occur, replaced by min-height: 900px

Twitter Bootstrap: non-responsive row in responsive layout

I'm using a responsive fluid grid system on my site, and in most cases the responsive Bootstrap behaviour is what I want: on small screens, the grid columns become fluid and stack vertically.
However, using grid nesting, inside a nested row this is not always the desired behaviour. There are some rows that are not supposed to be stacked vertically, regardless how small the screen is. This is exactly the behaviour of the whole grid when I completely disable all responsive CSS code, but obviously this is no alternative if the responsive behaviour is required for the outer rows.
The relevant markup is:
<div class="container-fluid">
<div class="row-fluid">
<div class="span6">This column should be stacked on small devices.</div>
<div class="span6">
<div class="row-fluid">
<div class="span6">Nested row. This column should NOT be stacked on small devices.</div>
<div class="span6">Nested row. This column should NOT be stacked on small devices.</div>
</div>
</div>
</div>
</div>
See this jsfidde for clarification.
How would one best solve this problem? Is there a way to do it with the native bootstrap functions?
[class*="span"] .span6 { display: inline-block; width: 48.61878453038674%}
example:
http://jsfiddle.net/NfTQ7/1/
What I have done to solve issues like this is the following:
<div class="row-fluid">
<div id="remove-mobile" class="span6">Nested row. This column should NOT be stacked on small devices.</div>
<div id="remove-mobile" class="span6">Nested row. This column should NOT be stacked on small devices.</div>
</div>
#media only screen and (max-width: 480px) {
#remove-mobile {
display:none;
}
}
That way, you get rid of that whole mess on smaller devices, and you can add code specifically targeted towards mobile sizes by simply doing the opposite:
<div class="row-fluid">
<div id="show-mobile" class="span6">Your Beautiful Code For Mobile Only</div>
</div>
#media only screen and (min-width: 481px) {
#show-mobile {
display:none;
}
}
#media only screen and (max-width: 480px) {
#show-mobile {
display:block;
}
#remove-mobile {
display:none;
}
}
It's not the simplest of solutions but I've found it suits my needs
https://github.com/twitter/bootstrap/blob/master/less/mixins.less#L572
If you dive into the source for bootstraps grid, it's relatively easy to pull out the less code used to generate the span[1-12] system.
So I just pulled out the basics and put them in my own file with a different selector. So now, when I want to use span's that don't wrap I just use .naps[1-12] (Span spelt backwards).
The responsive CSS looks for .span[1-12] selectors so it ignores my .naps elements.
It's not elegant, and it's not particularly scalable. It does work though :-/

Resources