ผู้เขียน หัวข้อ: How to make Simple Portal responsive using CSS3  (อ่าน 1733 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ smf

  • [color=green][i]"ถ้าคุณไม่สามารถอธิบายอย่างง่ายๆ ให้คนอื่นเข้าใจได้แล้วล่ะก็ แสดงว่าคุณยังเข้าใจมันไม่ดีพอ"[/i][/color]
  • Administrator
  • Hero Member
  • *****
  • กระทู้: 1,368
  • พอยท์: 5
    • ดูรายละเอียด
    • pordoo.com
    • อีเมล์
How to make Simple Portal responsive using CSS3
« เมื่อ: 30 มกราคม 2016, 23:47:45 »



Here's a quick and easy way to make the column blocks in Simple Portal v2.3.5 disappear as the page width changes using the @media query in CSS3.

A media query consists of a media type and at least one expression that limits the style sheets' scope by using media features, such as width, height, and color. Media queries, added in CSS3, allows the presentation of content be tailored to a specific range of output devices without having to change the content itself.

In this example, we're going to make the right-hand column 'disappear' as the width of the screen falls below 1100 pixels. You can change the limit to whatever you like.

First, open portal.css in the Themes\default\css folder.

Starting at line 248, find the following:
โค๊ด: [Select]
#sp_right
{
    vertical-align: top;
}
Replace with this:
โค๊ด: [Select]
@media (max-width: 1099px)
{
#sp_right
    {
        display:none;
    }
}
@media (min-width: 1100px)
{
#sp_right
    {
        vertical-align: top;
    }
}


Now, once the screen width falls below 1100 pixels, the right column is set to display: none, which will make it disappear.

This is just one example of how to use the @media query to change one rule. The @media query can be used with multiple selectors and declarations in CSS3, which opens endless possibilities for making your site more responsive.

You can also make the left column disappear when the screen width is smaller than a certain pixel so that only the middle column remains.

To set the left column to appear only when the screen size is larger than 800px, try this:

Open \Themes\default\css\portal.css

Find:
โค๊ด: [Select]
#sp_left
{
    vertical-align: top;
}
Replace with:
โค๊ด: [Select]
@media (max-width: 799px)
{
#sp_left
    {
        display:none;
    }
}
@media (min-width: 800px)
{
#sp_left
   {
    vertical-align: top;
   }
}

You can adjust the pixel width to whatever you want, just remember than the max-width: tag has to be 1 pixel smaller than the min-width: tag.

credit: http://www.smfhelp.com/index.php?topic=29.0