- Posts: 7
COMMUNITY FORUM
Image height
- Dawn Mellowship
- Topic Author
- Offline
- New Member
Less
More
14 years 4 months ago #82443
by Dawn Mellowship
Image height was created by Dawn Mellowship
K2 changes the image widths in different views but how do you set the heights of images so they are also uniform, because it looks odd having images of the same widths but all different heights.
Thanks
Dawn
Thanks
Dawn
Please Log in or Create an account to join the conversation.
- Yiota
- Visitor
14 years 4 months ago #82444
by Yiota
Replied by Yiota on topic Image height
Well you can control the image height through its outer container, such as an a element. If you have, for example, an image with 120px width and you want all heights to be 130px then you should write to your CSS file:
a {width:120px; height:130px; overflow:hidden; display:block;}
and then on a img { width:120px; height:auto;}
This should give you the result you need without messing with the image size.
a {width:120px; height:130px; overflow:hidden; display:block;}
and then on a img { width:120px; height:auto;}
This should give you the result you need without messing with the image size.
Please Log in or Create an account to join the conversation.
- Mats Arvendal
- Offline
- Premium Member
Less
More
- Posts: 147
14 years 2 months ago #82445
by Mats Arvendal
Replied by Mats Arvendal on topic Image height
Excellent!
I adapted this solution to the category view of a magazine website. I didn't use any width attributes so I was able to combine with K2 image management to achieve a satisfying solution when an article holds a "portrait" shaped photo. Anyhow, I think it would be nice if K2 had some kind of height management of the images. Would be a nice future addition.
Thanks!
Rgds
Yiota Ziaggou said:Well you can control the image height through its outer container, such as an a element. If you have, for example, an image with 120px width and you want all heights to be 130px then you should write to your CSS file:a {width:120px; height:130px; overflow:hidden; display:block;}and then on a img { width:120px; height:auto;}This should give you the result you need without messing with the image size.
I adapted this solution to the category view of a magazine website. I didn't use any width attributes so I was able to combine with K2 image management to achieve a satisfying solution when an article holds a "portrait" shaped photo. Anyhow, I think it would be nice if K2 had some kind of height management of the images. Would be a nice future addition.
Thanks!
Rgds
Yiota Ziaggou said:Well you can control the image height through its outer container, such as an a element. If you have, for example, an image with 120px width and you want all heights to be 130px then you should write to your CSS file:a {width:120px; height:130px; overflow:hidden; display:block;}and then on a img { width:120px; height:auto;}This should give you the result you need without messing with the image size.
Please Log in or Create an account to join the conversation.
- harris
- Offline
- New Member
Less
More
- Posts: 8
13 years 10 months ago #82446
by harris
Replied by harris on topic Image height
I was confused...could you please explain in which way i can set a standard height in item category view? Which css file i have to edit, the k2 css or my tamplate's css? It's a crucial subject, althought k2 is so powerful, this little attribute makes the difference...
thanks in advance.
Yiota Ziaggou said:Well you can control the image height through its outer container, such as an a element. If you have, for example, an image with 120px width and you want all heights to be 130px then you should write to your CSS file:
a {width:120px; height:130px; overflow:hidden; display:block;}
and then on a img { width:120px; height:auto;}
This should give you the result you need without messing with the image size.
thanks in advance.
Yiota Ziaggou said:Well you can control the image height through its outer container, such as an a element. If you have, for example, an image with 120px width and you want all heights to be 130px then you should write to your CSS file:
a {width:120px; height:130px; overflow:hidden; display:block;}
and then on a img { width:120px; height:auto;}
This should give you the result you need without messing with the image size.
Please Log in or Create an account to join the conversation.