S
S
Skrolea2016-11-20 18:11:39
css
Skrolea, 2016-11-20 18:11:39

How to fix the first element?

I'm making a news list. All news are maps except the first one - Codepen
For the first map, I change direction from column to row using the : pseudo first-child- class

.article-card {    
  display: flex; 
  flex-direction: column;
  margin: 0.5rem 0.6rem;
  width: 280px;  
  background-color: #ffffff;
  border-radius: 0.2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}
/* Вот тут хочется всё менять */
.article-card:first-child {    
  display: flex; 
  flex-direction: row;
  margin: 0.5rem 0.5rem;
  width: 100%;  
  background-color: #ffffff;
  border-radius: 0.2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

but I also need to change the image from
width: 100%;
    height: auto;
on the contrary
width: auto;
    height: 100%;

I need the width of the photo to be the width of the two bottom cards - how do I do that?
434e49bad4de4432abca2d9fab8dfed6.pngcode pen

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Ankhena, 2016-11-20
@Skrolea

If the width is known in points or %% - add 2 widths and the padding width and specify for the top image.
If the width is unknown: the blocks are independent, so count via JS.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question