Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to add scrollbar in fixed container
    primarykey
    data
    text
    <p>I want to add scrollbar in a fixed container of cart products so that when I will add too many products in cart, I can view it easily by scrolling down the products in the container</p> <p>Here is the HTML code of the container</p> <pre><code>?&gt; &lt;div class="right_nav" &gt; &lt;div class="right_nav_top"&gt; Your Cart &lt;/div&gt; &lt;hr width="130px"&gt; &lt;table width="167" border="0" cellpadding="0" cellspacing="0" style="font-size:12px; margin:5px; overflow:auto"&gt; &lt;?php //iterate through the cart, the $product_id is the key and $quantity is the value foreach($_SESSION['cart'] as $product_id =&gt; $quantity) { //get the name, description and price from the database - //this will depend on your database implementation. //use sprintf to make sure that $product_id is inserted into the query as a number - //to prevent SQL injection $sql = sprintf("SELECT event_title, event_desc, price FROM events WHERE id = %d;", $product_id); $result = mysql_query($sql); //Only display the row if there is a product //(though there should always be as we have already checked) if(mysql_num_rows($result) &gt; 0) { list($name, $description, $price) = mysql_fetch_row($result); $line_cost = $price * $quantity; //work out the line cost $totals = $total + $line_cost; //add to the total cost ?&gt; &lt;tr&gt; &lt;td colspan="3"&gt;&lt;?php echo $name;?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="31"&gt;&lt;?php echo $quantity;?&gt;x&lt;/td&gt; &lt;td width="59"&gt;&amp;pound&lt;?php echo $line_cost?&gt;&lt;/td&gt; &lt;td width="70"&gt; &lt;a href="&lt;?php Site_titte();?&gt;/viewcart.php?action=add&amp;id=&lt;?php echo $product_id;?&gt;" title="Add"&gt; &lt;img src="&lt;?php Site_titte();?&gt;/images/addred.png" width="24" height="24" border="none"&gt; &lt;/a&gt; &lt;a href="&lt;?php Site_titte();?&gt;/viewcart.php?action=remove&amp;id=&lt;?php echo $product_id;?&gt;" title="Remove"&gt; &lt;img style="margin-bottom:6px;" src="&lt;?php Site_titte();?&gt;/images/icon_close.png" border="none"&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php }}?&gt; &lt;/table&gt; &lt;?php if(!isset($_SESSION['uid'])) {$link="login.php";} else {$link=Site_titte()."/order.php";} ?&gt; &lt;hr width="130px"&gt; &lt;div class="total_main"&gt; &lt;div class="total_p1"&gt;Total&lt;/div&gt; &lt;div class="total_p2"&gt;&amp;pound&lt;?php echo $total ?&gt;&lt;/div&gt; &lt;div class="clearfix"&gt;&lt;/div&gt; &lt;/div&gt; &lt;br&gt; &lt;center&gt; &lt;a href="&lt;?php echo $link;?&gt;"&gt; &lt;img src="&lt;?php Site_titte();?&gt;/images/btn_order.png" border="none" width="140" height="38"&gt; &lt;/a&gt; &lt;/center&gt; &lt;/div&gt; &lt;?php } else { ?&gt; &lt;div class="right_nav2"&gt; &lt;div class="right_nav_top2"&gt; Your Cart &lt;/div&gt; &lt;hr width="130px"&gt; &lt;table border="0" cellpadding="0" cellspacing="5" style="font-size:14px; margin:5px;"&gt; &lt;tr&gt; &lt;td colspan="3"&gt;Your cart is empty.&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>and this is the css code </p> <pre><code>.right_nav2{ position: fixed; bottom: 0px; right: 0; top:220px; margin: 0 10px 10px 0; border: #DBDBDB 1px solid; border-radius: 5px; background-color:#fff; height:150px; width:150px; } .right_nav_top2{ position:relative; background:url(images/icon_cart_small.png) right no-repeat; color:#214200; margin: 12px; font-size: 19px; } .right_nav{ position: fixed; right: 0; top:220px; border: #DBDBDB 1px solid; border-radius: 5px; background-color:#fff; style="max-height: 552px;; width:150px; } .right_nav_top{ position:relative; background:url(images/icon_cart_small.png) right no-repeat; color:#214200; margin: 12px; font-size: 19px;} .total_main{ position:relative; background:#dbdbdb; font-size: 14px;} .total_p1{ position:relative; float:left; margin: 5px 11px 5px 12px;} .total_p2{ position:relative; float:left; margin: 5px 11px 5px 0px;} </code></pre> <p>Please help me where should I edit to add a scrollbar in this container </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload