Responsive elements in Joomla articles

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Fri Oct 03, 2014 3:28 pm
Reply with quote
Report this post
Hi,

I am using a table with 4 columns and 2 rows as element in Joomla articles. The first row contains images and second row contains texts description of the image above located. The problem is because tables are not responsive elements, so if I change the window size it looks really messy, even using <td width="x"> property. Is some code please you could suggest me to organize the content in such way without loosing the responsive property from this template?

Thanks in advance!
User avatar
Expert Boarder

GK User
Fri Oct 03, 2014 8:17 pm
Reply with quote
Report this post
You can set table to be 100% width, set columns size also basing on % width, and finally set images inside to have max 100% width.
User avatar
Moderator

GK User
Sat Oct 04, 2014 5:32 am
Reply with quote
Report this post
Looks better, however in small screens is a message "scroll horizontally to view the whole table". Other Gavick templates usually reorganize automatically in small screens columns vertically (One below of the others), some ideas how to achieve this with this template?

Thank you!
User avatar
Expert Boarder

GK User
Sat Oct 04, 2014 12:01 pm
Reply with quote
Report this post
With tables it can;t be done, but you could do this with use of some div's and css media-queries.
Create 2 divs that floats next to each other and if there is not enough space, you can remove float and display one under another.
User avatar
Moderator

GK User
Mon Oct 27, 2014 2:33 pm
Reply with quote
Report this post
Hi CYBEREK,

Thank you for your answer. I already tried with some code pieces founded on Internet without success. Maybe please could you help me with some code ideas using divs?

Thank you in advance!
User avatar
Expert Boarder

GK User
Mon Oct 27, 2014 4:52 pm
Reply with quote
Report this post
With 4 column (as example):
html:
Code: Select all
<div class="cWrapper">
<div class="c4">test 1</div>
<div class="c4">test 2</div>
<div class="c4">test 3</div>
<div class="c4">test 4</div>
</div>

css:
Code: Select all
.cWrapper {width: 100%; overflow: hidden}
.c4 {width: 25%; float: left;}

Just as an overview.
User avatar
Moderator

GK User
Wed Oct 29, 2014 7:15 am
Reply with quote
Report this post
It is working perfect. I just have to add some media queries to made it responsive:
Code: Select all
@media (max-width: 768px){
  .c4 {
   width: 40%;
   float: left;
   margin: 0 5%;
   }
}

@media (max-width: 480px){
  .c4 {
   width: 80%;
   float: left;
   margin: 0 10%;
   }
}


Thank you!!
User avatar
Expert Boarder

GK User
Wed Oct 29, 2014 4:41 pm
Reply with quote
Report this post
Yep, this way you have created 2 columns and 1 column when viewed on smaller screens.
Is there anything else I can help you with regarding this topic?
User avatar
Moderator

GK User
Thu Oct 30, 2014 4:11 pm
Reply with quote
Report this post
Is looking great now. That's everything. As usual you have a great support.

Thank you!
User avatar
Expert Boarder

GK User
Sat Nov 01, 2014 10:47 am
Reply with quote
Report this post
Thanks for the words of appreciation.
Please let me know if you will have any other questions regarding this topic.
User avatar
Moderator


cron