I am trying to develop a page footer in angular 6. I am using angular material and not using bootstrap.
Can anyone help to change this code into the angular material syntax?
I want to convert this footer into the full responsive Material UI design.
If possible then can I make this footer as responsive as well?
.app-footer {
margin-top: 2em;
text-align: center;
vertical-align:middle;
min-height: 100%
}
.app-footer-link {
line-height: 1.5em;
}
.app-footer-link p {
margin: 0;
}
.row/*:after*/ {
display: flex;
/*content: "";
display: table;
clear: both;*/
}
.firstrow/*:after*/ {
display: flex;
/*content: "";
display: table;
clear: both;*/
padding-top: 20px;
}
.column {
flex: 25%;
/*width:20%;*/
float:left;
font-size:12px;
}
.headingcolumn {
flex: 25%;
/*width:20%;*/
float:left;
font-size:18px;
/*line-height:12px;*/
}
.maincolumnleft {
flex: 50%;
/*width: 50%;*/
float: left;
}
.maincolumnright {
/*flex: 50%;*/
width: 50%;
float: right;
}
.fullcolumn {
width: 100%;
/*flex:100%;*/
font-size: 12px;
text-align: center;
vertical-align: middle;
}
.heading{
font-size:18px;
}
#media screen and (max-width: 600px) {
.column {
/*flex:100%;*/
width: 100%;
}
.headingcolumn {
/*flex: 100%;*/
width: 100%;
}
.maincolumnleft {
/*flex: 100%;*/
width: 100%;
}
.maincolumnright {
/*flex: 100%;*/
width: 100%;
}
}
------------footer.component.html---------------------------
<footer class="app-footer">
<div class="app-footer-link">
<div class="firstrow">
<div class="headingcolumn"></div>
<div class="headingcolumn">B</div>
<div class="headingcolumn">S</div>
<div class="headingcolumn">About Us</div>
<div class="headingcolumn">C Service</div>
</div>
<div class="row">
<div class="column"></div>
<div class="column">New Acc</div>
<div class="column">New Acc</div>
<div class="column">About</div>
<div class="column">Help</div>
</div>
<div class="row">
<div class="column"></div>
<div class="column">Cat</div>
<div class="column">St</div>
<div class="column">Sit</div>
<div class="column">Contact Us</div>
</div>
<div class="row">
<div class="fullcolumn">
<span class="heading">Follow:</span>
</div>
</div>
<div class="row">
<div class="fullcolumn">
Copyright © {{getYear()}}
</div>
</div>
</div>
</footer>
Updated
footer{
background: tomato;
display: flex;
flex-direction: column;
flex-wrap: wrap; /*flex items will wrap onto multiple lines, from top to bottom.*/
padding: 20px;
}
.section-top{
background: yellow;
display: flex;
justify-content: center; /*items are centered along the line*/
padding: 20px 0;
}
.section-bottom{
background: blue;
text-align: center;
padding: 15px 0;
}
.col{
margin: 0 15px;
width: 25% /*optional*/
}
#media all and (max-width: 600px){ /*style if screen size is <600px*/
.section-top{
flex-direction: column;
}
.col{
text-align: center;
width: 100%;
margin: 0
}
}
<footer>
<section class="section-top">
<div class="col">
<h3>Title</h3>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit,</div>
<div>Lorem ipsum dolor sit amet.</div>
<div>Line 3</div>
</div>
<div class="col">
<h3>Title</h3>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit,</div>
<div>Lorem ipsum dolor sit amet.</div>
<div>Line 3</div>
</div>
<div class="col">
<h3>Title</h3>
<div>Line 2</div>
<div>Line 3</div>
</div>
<div class="col">
<h3>Title</h3>
<div>Line 2</div>
</div>
</section>
<section class="section-bottom">
<div>Follow</div>
<div>Copy right</div>
</section>
</footer>
Related
How can I align two divs, "Label 1" and "Label 2", inside of the card as shown in the image below?
.card {
position: relative;
}
.card .label1 {
display: inline-block;
position: absolute;
bottom: 16px;
}
.card .label2 {
display: inline-block;
position: absolute;
bottom: 16px;
}
<div class="card">
<div class="image"><img src="http://www.fillmurray.com/140/100" /></div>
<div class="title">Title</div>
<div class="description">
<p>Lorem ipsum dolor sit amet.</p>
</div>
<div class="label1">Label 1</div>
<div class="label2">Label 2</div>
</div>
I need to align "Label 1" and "Label 2", so they are located in one row and follow each other. It may also happen that one of the labels is not there, so I can not have fixed position for each of them. I can not put the labels in a container element (e.g. I can't wrap label1 and label2 in a <div>).
Flexbox can do that without additional wrappers.
The trick here is to set the containers above the labels to be 100% wide and center the contents.
.card {
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: 80%;
border: 1px solid red;
margin: 1em auto;
justify-content: space-around;
padding: 1em;
}
.image,
.title,
.description {
flex: 1 0 100%;
text-align: center;
}
.label1,
.label2 {
background: red;
padding: 1em;
}
<div class="card">
<div class="image"><img src="http://www.fillmurray.com/140/100" /></div>
<div class="title">Title</div>
<div class="description">
<p>Lorem ipsum dolor sit amet.</p>
</div>
<div class="label1">Label 1</div>
<div class="label2">Label 2</div>
</div>
Hope it might help you
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.card {
width: 250px;
height: 250px;
border: 1px solid red;
display: flex;
padding: 5px;
text-align: center;
justify-content: space-around;
}
.label {
padding: 10px;
width: 80px;
height: 20px;
text-align: center;
border: 1px solid black;
}
</style>
</head>
<body>
<div class="card">
<div class="label">Label 1</div>
<div class="label">Label 2</div>
</div>
</body>
</html>
I want an image to be 'inside' a box delimited by max_width and max_height.
Instead the image goes over/under the text below.
Should work also in IE10 and above.
.image {
max-height: 9.75rem;
max-width: 14.625rem;
margin: 0 0.75rem 0 0;
}
.image img
max-height: 90%;
max-width: 90%;
}
.text {
color: red;
font-size: 14px;
<div class="section">
<h3 class="title">Image</h3>
<div class="image">
<img src="http://via.placeholder.com/350x350"/>
</div>
</div>
<div class="section">
<h3 class="title">Item</h3>
<div class="text">Lorem ipsum sic dolores</div>
</div>
I think you should inherit the max-width and max-height value for img from it's div container. Please review if this is what you are looking for:
.image {
max-height: 9.75rem;
max-width: 14.625rem;
margin: 0 0.75rem 0 0;
}
.image img{
max-height: inherit;
max-width: inherit;
}
.text {
color: red;
font-size: 14px;
}
<div class="section">
<h3 class="title">Image</h3>
<div class="image">
<img src="http://via.placeholder.com/350x350"/>
</div>
</div>
<div class="section">
<h3 class="title">Item</h3>
<div class="text">Lorem ipsum sic dolores</div>
</div>
Even though you set max-width or max-height you need to have a specified width or height property here.
.image {
margin: 0 0.75rem 0 0;
}
.image img {
max-height: 9.75rem;
max-width: 14.625rem;
}
.text {
color: red;
font-size: 14px;
}
<div class="section">
<h3 class="title">Image</h3>
<div class="image">
<img src="http://via.placeholder.com/350x350" />
</div>
</div>
<div class="section">
<h3 class="title">Item</h3>
<div class="text">Lorem ipsum sic dolores</div>
</div>
.image {
max-height: 9.75rem;
max-width: 14.625rem;
margin: 0 0.75rem 0 0;
}
.image img {
display:block;
max-height: 9.75rem;
}
.text {
color: red;
font-size: 14px;
}
<div class="section">
<h3 class="title">Image</h3>
<div class="image">
<img src="http://via.placeholder.com/350x350"/>
</div>
</div>
<div class="section">
<h3 class="title">Item</h3>
<div class="text">Lorem ipsum sic dolores</div>
</div>
I am trying to create a tube module for a tree grid. I want to keep the tube as one block and have each column as an element within the block. I would like to apply an offset to the tube so the tube below has an indent, but I'm running into an issue with the column borders lining up. How do I apply an offset to the first column of the block without applying it to the whole tube.
Here is the HTML:
<div class="m-tube">
<div class="m-tube__column">
<span class="m-tube__column--icon"></span>
<div class="m-tube__text">Lorem Ipsum</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Tempus Fugit</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Fac Ut Gaudeum</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Lorem Ipsum Dolor Sit Amet</div>
</div>
<div class="m-tube__column m-tube__column--no-border">
<div class="m-tube__text">Caveat Emptor</div>
</div>
</div>
<div class="m-tube">
<div class="m-tube__column">
<span class="m-tube__column--icon"></span>
<div class="m-tube__text">Lorem Ipsum</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Tempus Fugit</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Fac Ut Gaudeum</div>
</div>
<div class="m-tube__column">
<div class="m-tube__text">Lorem Ipsum Dolor Sit Amet</div>
</div>
<div class="m-tube__column m-tube__column--no-border">
<div class="m-tube__text">Caveat Emptor</div>
</div>
</div>
And here is the SCSS:
.m-tube {
border: 1px solid silver;
border-radius: 3rem;
width: auto;
height: 3.5rem;
display: table;
&:hover {
background-color: lightblue;
}
&--no-end-cap {
border-radius: 3rem 0 0 3rem;
border-right: 0;
}
&__column {
border-right: 1px solid silver;
padding: 0 0.5rem;
height: 100%;
display: inline-table;
//vertical-align: middle;
&--no-border {
border-right: 0;
}
&--icon {
background-color: red;
height: 1.5rem;
width: 1.5rem;
}
}
&__text {
line-height: 3.4rem;
color: #01527a;
font-size: 1.1rem;
font-family: Helvetica, Arial, sans-serif;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
}
I can't find a way to remove the 13px of white space under the image. I would like that the div is the same size of the image, but responsive. I tried to add padding and margin, but nothing changes. Thank you!
screenshot
html, body {
font-family: "Helvetica";
height: 100vh;
margin: 0;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.content-white {
background-color: #fff;
color: #000;
width: 100%;
text-align: center;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
align-items: center;
flex-wrap: wrap;
min-width: 320px;
max-width: 1220px;
}
/* image grid */
#css-table {
display: table;
}
#css-table .col {
display: table-cell;
width: 33%;
}
.clearboth {
clear: both;
}
.cube {
vertical-align: middle;
font-size: 50px;
border: 1px solid #000;
}
.cube-text {
}
.cube img {
width:100%;
}
.cdesc {
font-family: "Helvetica Light";
font-size: 16px;
}
<div class="flex-center position-ref">
<div id="css-table" class="content-white">
<div>
<div class="col cube">
<img src="http://placehold.it/400x400" />
</div>
<div class="col cube cube-text">
TEXT
<p class="cdesc">Lorem ipsum dolor sit amet <br/> Lorem ipsum dolor sit amet.</p>
</div>
<div class="col cube">
<img src="http://placehold.it/400x400" />
</div>
<div class="clearboth"></div>
<div class="col cube cube-text">
TEXT
<p class="cdesc">Lorem ipsum dolor sit amet <br/> Lorem ipsum dolor sit amet.</p>
</div>
<div class="col cube" >
<img src="http://placehold.it/400x400" />
</div>
<div class="col cube cube-text">
TEXT
<p class="cdesc">Lorem ipsum dolor sit amet <br/> Lorem ipsum dolor sit amet.</p>
</div>
</div>
</div>
</div>
Set the image to display: block or display: inline-block.
html, body {
font-family: "Helvetica";
height: 100vh;
margin: 0;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.content-white {
background-color: #fff;
color: #000;
width: 100%;
text-align: center;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
align-items: center;
flex-wrap: wrap;
min-width: 320px;
max-width: 1220px;
}
/* image grid */
#css-table {
display: table;
}
#css-table .col {
float:left; /* Changed here */
width: 33%;
}
.clearboth {
clear: both;
}
.cube {
vertical-align: middle;
font-size: 50px;
border: 1px solid #000;
height:207.33px; /* Added a height */
}
.cube-text {
}
.cube img {
width:100%;
}
.cdesc {
font-family: "Helvetica Light";
font-size: 16px;
}
<div class="flex-center position-ref">
<div id="css-table" class="content-white">
<div>
<div class="col cube">
<img src="http://placehold.it/400x400" />
</div>
<div class="col cube cube-text">
TEXT
<p class="cdesc">Lorem ipsum dolor sit amet <br/> Lorem ipsum dolor sit amet.</p>
</div>
<div class="col cube">
<img src="http://placehold.it/400x400" />
</div>
<div class="clearboth"></div>
<div class="col cube cube-text">
TEXT
<p class="cdesc">Lorem ipsum dolor sit amet <br/> Lorem ipsum dolor sit amet.</p>
</div>
<div class="col cube" >
<img src="http://placehold.it/400x400" />
</div>
<div class="col cube cube-text">
TEXT
<p class="cdesc">Lorem ipsum dolor sit amet <br/> Lorem ipsum dolor sit amet.</p>
</div>
</div>
</div>
</div>
I want to create a layout for an itemised list of content like below:
Each item is a container that has an image and block of text.
I have attempted to use nth-child and set different css float values based on if it is an odd or even child, but you can't set child properties using the nth-child selector.
HTML:
<div class="flex-container">
<div class="media-container ">
<img src="img/image.png">
</div>
<div class="text-container">
<div class="titles">
<h2>Title #1</h2>
</div>
<p>lots of words</p>
</div>
</div>
<div class="flex-container">
<div class="media-container ">
<img src="img/image.png">
</div>
<div class="text-container">
<div class="titles">
<h2>Title #1</h2>
</div>
<p>lots of words</p>
</div>
</div>
<div class="flex-container">
<div class="media-container ">
<img src="img/image.png">
</div>
<div class="text-container">
<div class="titles">
<h2>Title #1</h2>
</div>
<p>lots of words</p>
</div>
</div>
CSS:
.flex-container {
width: auto;
margin: 10px auto;
padding: 0 15px;
display: inline-flex;
}
.flex-container:nth-child(odd) {
.media-container {
float: left;
}
.text-container {
float: right;
}
}
.flex-container:nth-child(even) {
.media-container {
float: right;
}
.text-container {
float: left;
}
}
.media-container {
position: relative;
display: inline-block;
}
.media-container img {
width: 100%;
height: auto;
}
.text-container {
width: 30%;
margin: 0 10px;
align-self: center;
position: relative;
display: inline-block;
}
What is the easiest/neatest solution for creating this layout using CSS?
Something like this:
Use the nth-child on your "row" flex-containers and alternate the flex-direction.
.flex-container {
padding: 0 15px;
display: flex;
width: 80%;
border: 1px solid grey;
margin: 1em auto;
}
.flex-container:nth-child(odd) {
flex-direction: row;
}
.flex-container:nth-child(even) {
flex-direction: row-reverse;
}
.media-container img {
width: 100%;
height: auto;
}
.text-container {
width: 30%;
margin: 0 10px;
}
<div class="flex-container">
<div class="media-container ">
<img src="http://www.fillmurray.com/300/200">
</div>
<div class="text-container">
<div class="titles">
<h2>Title #1</h2>
</div>
<p>lots of words</p>
</div>
</div>
<div class="flex-container">
<div class="media-container ">
<img src="http://www.fillmurray.com/300/200">
</div>
<div class="text-container">
<div class="titles">
<h2>Title #1</h2>
</div>
<p>lots of words</p>
</div>
</div>
Take A Look At This:
.item {
width: 305px;
height: 70px;
background: black;
margin: 5px;
padding: 5px;
}
.item .title {
width: 200px;
height: 70px;
background: crimson;
}
.item .img {
width: 100px;
height: 70px;
background: #09f;
}
.item:nth-child(even) .img {
float: right;
}
.item:nth-child(even) .title {
float: left;
}
.item:nth-child(odd) .img {
float: left;
}
.item:nth-child(odd) .title {
float: right;
}
<div class='item'>
<div class='title'></div>
<div class='img'></div>
</div>
<div class='item'>
<div class='title'></div>
<div class='img'></div>
</div>
<div class='item'>
<div class='title'></div>
<div class='img'></div>
</div>
Is it necessary that it is display:inline-flex? If you change it to inline-block, I believe you'll get your intended display:
.flex-container {
display: inline-block;
...
}
https://jsfiddle.net/4rcdqy4f/
You can use the Javascript querySelectorAll() method. Then, loop through the list of your items and add the specific CSS property based on whether it is odd or even.