I am trying to adapt the Material Design in my personal website using materializecss.com, however the framework only provide options to exclude otherwise images on top of the CARD design.
I want to achieve something as shown below in the link [2nd row, 2nd column/ last image] where the image is sitting at left beside the main content, wondering if anyone could help me on this and I would really appreciate your help on this. thanks!
Card Material Design Example
#vizFlux
Here is the code which you want
.card-image {
float: left;
width: 40%;
height: 250px;
}
.card-image img {
height: 100%;
}
.right-content {
width: 60%;
float: left;
}
.card-title {
padding-left: 20px;
}
<div class="card">
<div class="card-image">
<img src="images/sample-1.jpg" class="hoverZoomLink">
</div>
<div class="right-content">
<span class="card-title">Card Title</span>
<div class="card-content">
<p>I am a very simple card. I am good at containing small bits of information. I am convenient because I require little markup to use effectively.
</p>
</div>
<div class="card-action">
This is a link
</div>
</div>
</div>
the output should look something like this:
.card-image {
float: left;
width: 40%;
height: 250px;
}
.card-image img {
height: 100%;
}
.right-content {
width: 60%;
float: left;
}
.card-title {
padding-left: 20px;
}
<div class="card">
<div class="card-image">
<img src="http://www.sauna-nj.co.jp/wp-content/uploads/2017/03/topa-zu.jpg" class="hoverZoomLink">
</div>
<div class="right-content">
<span class="card-title">Card Title</span>
<div class="card-content">
<p>岩盤浴で使用されるのは極めて珍しい鉱石です。加熱変色する宝石の代表。またその中でも大変珍しく、加熱や摩擦圧力で帯電し数時間は維持することができます。その後中和状態に戻る際に発する電荷を身体に受けることで肩こりや冷え性の改善、神経性疲労や神経衰弱の回復など様々な症状を改善するといわれています。
</p>
</div>
<div class="card-action">
This is a link
</div>
</div>
</div>
This should help
http://materializecss.com/cards.html
<div class="row">
<div class="col s12 m7">
<div class="card">
<div class="card-image">
<img src="images/sample-1.jpg">
<span class="card-title">Card Title</span>
</div>
<div class="card-content">
<p>I am a very simple card. I am good at containing small bits of information.
I am convenient because I require little markup to use effectively.</p>
</div>
<div class="card-action">
This is a link
</div>
</div>
</div>
</div>
Related
I do have the following HTML output:
so, as you can see the footer isn't matching...
my css component looks like this:
.card-equal-height {
display: flex;
flex-direction: column;
height: 100%;
}
.card-equal-height
.card-footer {
margin-top: auto;
height: 100%;
}
.card-equal-height.card-footer this part is not working somehow. I want the footer to be matching the order cards, no matter how long the description is.
html:
<div [ngClass]="{'card-highlight': product.listItemHovered}" class="card card-equal-height"
(mouseenter)="hoverListItem(product)"
(mouseleave)="hoverListItem(product)"
(click)="test(product)">
<div class="card-image">
<figure class="image is-square">
<img [src]="product.imageURL" alt="{{product.title}}">
</figure>
</div>
<div class="card-content">
<p class="title has-text-centered"> {{product.title}}</p>
<p class="subtitle">{{product.price | currency: "USD"}}</p>
</div>
<div class="card-footer">
<p class="card-footer-item">
<button (click)="removeFromCart(product); showRemoved()"
class="button is-danger is-outlined is-pulled-left is-small"> Remove
</button>
</p>
<p class="card-footer-item">
<button (click)="addToCart(product);showAdded()"
class="button is-outlined is-primary is-pulled-right is-small"> Add to Cart
</button>
</p>
</div>
</div>
I think you can achieve changing the height of "card-content" (forget change the .card-footer) using flex-grow
.card-equal-height
.card-content {
flex-grow:1;
}
For more about flex, check this link in css-tricks
In this CodePen, I am trying to get the .icon div to appear the full height of the div it's in. Unfortunately, it looks like it's loading before the text is there so the div has a height of 0 when it loads. How would I get it to load once the text is there and grab that full height? Preferably with no JS if possible.
All help is appreciated!
HTML
.faqSection {
height: 600px;
width: 100vw;
}
.topFaqSection {
margin: 100px 0 40px 10vw;
}
.innerFaqSection {
height: 100%;
width: 100%;
display: flex;
justify-content: center;
}
.leftFaq {
width: 35%;
height: 100%;
/* background-color: violet; */
}
.rightFaq {
width: 35%;
height: 100%;
/* background-color: blanchedalmond; */
}
.singleFaqBlock {
margin: 20px 0 0 0;
}
.questionBlock {
background-color: red;
display: flex;
flex-direction: row;
align-content: flex-start;
}
.icon {
background-color: blue;
width: 50px;
height: 100%;
}
.questionText {
/* display: none; */
background-color: green;
width: 100%;
}
.answerBlock {}
.answerBlock p {
margin: 0 0 0 62px;
}
.hiddenText {
display: none;
}
.notHiddenText {
display: block;
}
<div class="faqSection">
<div class="topFaqSection">
<h1>Questions? Look Here</h1>
<div class="bar blue"></div>
</div>
<div class="innerFaqSection">
<div class="leftFaq">
<div class="singleFaqBlock">
<div class="questionBlock">
<div class="icon">
<div class="circle-plus closed">
<div class="circle">
<div class="horizontal"></div>
<div class="vertical"></div>
</div>
</div>
</div>
<div class="questionText">
<h3>
How do I earn a return?
</h3>
</div>
</div>
<div class="answerBlock">
<p class="hiddenText">
Yes! We would love to answer your question thank you for giving us the opoportunity!!
</p>
</div>
</div>
<div class="singleFaqBlock">
<div class="questionBlock">
<div class="icon">
<div class="circle-plus closed">
<div class="circle">
<div class="horizontal"></div>
<div class="vertical"></div>
</div>
</div>
</div>
<div class="questionText">
<h3>
What kind of returns can I expect?
</h3>
</div>
</div>
<div class="answerBlock">
<p class="hiddenText">
Yes! We would love to answer your question thank you for giving us the opoportunity!!
</p>
</div>
</div>
</div>
<div class="space"></div>
<div class="rightFaq">
<div class="singleFaqBlock">
<div class="questionBlock">
<div class="icon">
<div class="circle-plus closed">
<div class="circle">
<div class="horizontal"></div>
<div class="vertical"></div>
</div>
</div>
</div>
<div class="questionText">
<h3>
When is the platform releasing?
</h3>
</div>
</div>
<div class="answerBlock">
<p class="hiddenText">
Yes! We would love to answer your question thank you for giving us the opoportunity!!
</p>
</div>
</div>
<div class="singleFaqBlock">
<div class="questionBlock">
<div class="icon">
<div class="circle-plus closed">
<div class="circle">
<div class="horizontal"></div>
<div class="vertical"></div>
</div>
</div>
</div>
<div class="questionText">
<h3>
Why invest in real estate? </h3>
</div>
</div>
<div class="answerBlock">
<p class="hiddenText">
Yes! We would love to answer your question thank you for giving us the opoportunity!!
</p>
</div>
</div>
<div class="singleFaqBlock">
<div class="questionBlock">
<div class="icon">
<div class="circle-plus closed">
<div class="circle">
<div class="horizontal"></div>
<div class="vertical"></div>
</div>
</div>
</div>
<div class="questionText">
<h3>
I'm a - and interested in raising money through -, what should I do? </h3>
</div>
</div>
<div class="answerBlock">
<p class="hiddenText">
Yes! We would love to answer your question thank you for giving us the opoportunity!!
</p>
</div>
</div>
</div>
</div>
</div>
As I said in a a comment, removing the height: 100% rule should fix it for you. The "why" for it is a bit... unsavory.
Flex children default to "align-self: stretch", so they'll stretch naturally. But when you set a height, it will use that value. The problem is percentage height is calculated from the height actually specified for the parent and .icon's parent (.questionBlock) has no height specified: so .icon gets 100% of 0. If you were to set a height to .questionBlock, .icon would adapt.
From the specs:
The percentage is calculated with
respect to the height of the generated box's containing block. If the
height of the containing block is not specified explicitly (i.e., it
depends on content height), and this element is not absolutely
positioned, the value computes to 'auto'.
This is the comment that pointed me into the right direction. Maybe check it out?
I have a container with 4 rows each row has two columns in 4:8 ratio.
For each column it works perfectly for screens with width more than 1080px, for less than this the content overlaps.
What i want to do, is make all the columns turn into rows with a full width of the screen.
If anyone have any recommendation to get better results please help me.
I have found many questions for people having the same issue and tried their solution but nothing worked for me.
.proctitleleft {
font-size: 20px;
position: absolute;
left: 90px;
top: 20px;
bottom: 20px;
}
.procimageleft {
position: relative;
margin-bottom: 40px;
margin-right: 90px;
margin-top: 20px;
}
.procimageright {
position: relative;
margin-bottom: 40px;
margin-left: 90px;
}
.procparagleft1 {
position: absolute;
left: 100px;
top: 138px;
font-size: 14px;
}
.procparagleft2 {
position: absolute;
left: 100px;
top: 138px;
font-size: 14px;
}
.procparagleft3 {
position: absolute;
left: 100px;
top: 138px;
font-size: 14px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="processcontainer">
<div class="arw_tab_title">
<div class="tab_title">
<h2 class="title">The Process</h2>
<p class=""></p>
</div>
<div class="tab_sub_title">
<h2 class="title">our perfect process</h2>
</div>
</div>
<div class="row">
<div class="col-xs-8">
<div class="proctitleleft">
<h3>1-Far far away</h3>
</div>
<div class="procparagleft1">
<p>It all started with a farmer and his extraordinary efforts to grow what people later called the best cotton in town
<br>To Bangladesh we went to see if that was true.And it was!<br>
</p>
</div>
</div>
<div class="col-xs-4">
<div class="procimageleft">
<img src="https://cdn.shopify.com/s/files/1/1965/8259/t/4/assets/process1.png">
</div>
</div>
<div class="row">
<div class="col-xs-4">
<div class="procimageright">
<img src="https://cdn.shopify.com/s/files/1/1965/8259/t/4/assets/process2.png">
</div>
</div>
<div class="col-xs-8">
<div class="proctitleleft">
<h3>2-Lavish Studio left their mark </h3>
</div>
<div class="procparagleft2">
<p>Oh buddy! What can I say?
<br>Working around the clock to deliver powerful yet very elegant designs that was approved by an internal community before seeing the light of day<br>
</p>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-8">
<div class="proctitleleft">
<h3>3-Complete the artwork</h3>
</div>
<div class="procparagleft3">
<p>Partnering up with the same factory that deal with Adidas, Reebok and Name, we were able to transform an idea into a very big powerful reality
</p>
</div>
</div>
<div class="col-xs-4">
<div class="procimageleft">
<img src="https://cdn.shopify.com/s/files/1/1965/8259/t/4/assets/process3.png">
</div>
</div>
</div>
<div class="row">
<div class="col-xs-4">
<div class="procimageright">
<img src="https://cdn.shopify.com/s/files/1/1965/8259/t/4/assets/process4.png">
</div>
</div>
<div class="col-xs-8">
<div class="proctitleleft">
<h3>4- Quality meets perfection
</h3>
</div>
<div class="procparagleft2">
<p>We stand by our products because we’re confident in what we deliver.
<br> That’s why we designed an unsurpassed shopping and unboxing experience to befit such creations
<br>
</p>
</div>
</div>
</div>
</div>
use col-md-4 and col-md-8 instead of col-xs-* so you have 4:8 ratio above 992px width and full col-width under 992px. You don't have to do it by your own. It's the standard behavior of bootstrap.
see https://getbootstrap.com/css/#grid-media-queries for further details
use three classes col-md-4, col-sm-4 and col-xs-12, last one for smallest devices full width div tag.
I have a problem.
I would like to center three icons on a website like so:
http://prntscr.com/cte4kt
Including the text under it.
I have searched on google, but I had no good results.
If somebody could show a simple example that would be really greatfull.
this is what I tried:
<div class="testDiv">
<img style="width: 100px; height: 100px;" src="https://s21.postimg.org/jc5m4w0av/search.png">
<h3>Insert text</h3>
<h4>This is an actual test<br>
I really mean it lol.
</h4>
<img style="width: 100px; height: 100px;" src="https://s21.postimg.org/jc5m4w0av/search.png">
<h3>Insert text</h3>
<h4>This is an actual test<br>
I really mean it lol.
</h4>
<img style="width: 100px; height: 100px;" src="https://s21.postimg.org/jc5m4w0av/search.png">
<h3>Insert text</h3>
<h4>This is an actual test<br>
I really mean it lol.
</h4>
CSS:
http://pastebin.com/v0cc1cXg
Thankyou.
I think you already know some basic HTML/CSS stuff so I'd recommend you use some of popular front-end frameworks like Bootstrap or Zurb Foundation. It's almost copy/paste only thing.
You can use something like bootstrap or primercss which give you classes to add rows and columns to layout your content.
You could also create your own like the example I did here
<div class="container">
<div class="row">
<div class="col3 center">
<div class="inner-container">
<i>icon</i>
<div>text</div>
</div>
</div>
<div class="col3">
<div class="inner-container">
<i>icon</i>
<div>text</div>
</div>
</div>
<div class="col3">
<div class="inner-container">
<i>icon</i>
<div>text</div>
</div>
</div>
</div>
</div>
.container {
position: relative;
width: auto;
height: 200px;
}
.row {
width: 100%;
height: 100%;
}
.col3 {
float: left;
width: 33.3%;
height: 100%;
background: grey;
}
.inner-container {
position: relative;
top: 30%;
text-align: center;
}
Basically you need to create some type of layout container(width:100%) with three columns split by thirds(width:33.3%). Then inside each of those columns you position the contents with (text-align:center) to horizontally center align the content and vertically align it via something like top:30% or if you could also do an inline-block with vertical-align: middle.
So, I'm trying to get this to display properly on mobile phone for the class 'circle-right right' div. Right now, instead of being centered, the circle-right class is displaying too far to the right instead of center. On desktop it displays correctly.
<div class="path-container">
<div class="row">
<div class="large-12 columns ">
</div>
</div>
<div class="row path-item">
<div class="large-7 push-5 columns">
<div id="img1" class="circle circle-left "></div>
</div>
<div class="large-5 pull-7 columns path-text left">
<h3 id="pstop1">Get in touch!</h3>
<a class="pathlinks" href="#" data-reveal-id="myModal">Get in touch>></a>
</div>
</div>
<div class="row path-item">
<div class="large-7 columns">
<div id="img2" class="circle circle-right right"></div>
</div>
<div class="large-5 columns path-text right">
<h3 id="pstop2">Give us feedback!</h3>
<p class="shadow">We're not happy unless your satisfied. During the process, we'll be in touch to make sure we're on the right track.</p>
Get in touch>>
</div>
This is most of the default css that comes with the foundation path template. Tried using media query to select the class and adjust the position, but it wont work. Here's a link to the template http://patterntap.com/code/responsive-timeline
css:
.path-container .path-item .circle.circle-right {
right: 100px;
}
.path-container {
text-align: center;
}
.path-container .circle {
top: 0;
right: 0;
left: 0;
float: none;
margin-bottom: 30px !important;
margin-top: 60px;
margin-left: auto;
margin-right: auto;
}