i am trying to make a table which has an individual horizontal scroll per table row which is dynamic. my code only works for the whole table itself but not the individual rows.
<table class="table-mainprojects">
<tr>
<th>Date Disbursed:(YYYY-MM-DD)</th>
<th>Disbursed<br>Project<br>Fund<br>(PHP)</th>
</tr>
while($row = mysqli_fetch_assoc($result)){?>
<div class="horizontal">
<tr>
<td><?php echo "$row[date_disbursed]"; ?><br/> </td>
<td><?php echo number_format($row['cost_disbursed'], 2); ?> <br/>
</td>
<input type="hidden" name="id" id="hiddenField" value="<?php echo
"$row[id]";?>" />
</tr>
</div>
<?php } ?>
</table>
CSS
.table-mainprojects {
display: block;
white-space: nowrap;
overflow: auto;
}
.table-mainprojects > .horizontal {
display: block;
overflow: auto;
white-space: nowrap;
}
Instead of using a classic table, maybe try using divs and revise your html as a flex or grid. It's easy enough to make a table out of a grid or flex:
<style>
.table > div.row {
display: grid;
grid-template-columns: auto auto 200px 200px;
overflow: auto;
max-width: 300px;
}
div.row div {
padding: 10px;
}
</style>
<div class="table">
<div class="row">
<div>one</div>
<div>two</div>
<div>three</div>
<div>four</div>
</div>
<div class="row">
<div>one</div>
<div>two</div>
<div>three</div>
<div>four</div>
</div>
</div>
Here is an example of that scenario: https://jsfiddle.net/qcc14hdk/
Related
I have read many questions and many articles but cant find my answer Here is my code result
Here is my code
.checkout-cart-total {
background-color: #f5f5f5;
padding: 45px;
}
#media only screen and (max-width: 575px) {
.checkout-cart-total {
padding: 30px;
}
}
.checkout-cart-total h4 {
flex-basis: 18px;
line-height: 23px;
font-weight: 600;
color: #292929;
}
.checkout-cart-total h4:first-child {
margin-top: 0;
margin-bottom: 25px;
}
.checkout-cart-total h4:last-child {
margin-top: 15px;
margin-bottom: 0;
}
.checkout-cart-total h4 span {
float: right;
display: block;
}
.checkout-cart-total ul {
border-bottom: 1px solid #292929;
}
.checkout-cart-total ul li {
color: #292929;
font-size: 14px;
line-height: 23px;
font-weight: 600;
display: block;
margin-bottom: 16px;
}
.checkout-cart-total ul li span {
color: #292929;
float: right;
}
.checkout-cart-total p {
line-height: 30px;
font-weight: 600;
color: #292929;
padding: 10px 0;
border-bottom: 1px solid #292929;
margin: 0;
}
.checkout-cart-total p span {
float: right;
}
<div class="col-12 mb-60">
<h4 class="checkout-title">Cart Total</h4>
<div class="checkout-cart-total">
<h4>Product <span>Total</span></h4>
<ul>
<?php
$cartres = $fetchcart->fetchAll(PDO::FETCH_ASSOC);
foreach($cartres as $row){
?>
<li>
<input type="text" disabled value="<?php echo $row['p_name']; ?>" name="product_name[]" style="color:#292929;font-size:14px;font-weight:600;display:inline;float:left;border:none;background:transparent;"> X
<input type="text" disabled value="<?php echo $row['qty']; ?>" name="qty[]" style="color:#292929;font-size:14px;font-weight:600;display:inline;float:left;border:none;background:transparent;">
<span><input type="text" disabled value="<?php echo $row['price']; ?>" name="product_name[]" style="color:#292929;font-size:14px;font-weight:600;float:left;display:inline;border:none;background:transparent;"><input type="text" disabled value="<?php echo $row['p_id']; ?>" hidden name="product_id[]" style="color:#292929;font-size:14px;font-weight:600;float:left;display:inline;border:none;background:transparent;"></span>
</li>
<?php } ?>
</ul>
</div>
</div>
Help me to figure out how to align this I have done many techniques like the form-inline bootstrap class but doesn't work for me. Because I am submitting two data at a time so I cant use form-inline class first form is for user details and second for product details and checkout at a time.
The best design can be achieved using tables. This is what tables are used for - representation of data. You can also use <input type="number"> for quantity and update total price accordingly.
DOCS: https://getbootstrap.com/docs/4.5/content/tables/
/*DEMO*/body{padding:2rem}input[type="number"]{max-width:75px}
tbody th,tbody td{vertical-align:middle!important}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<div class="row">
<div class="col-12">
<h4>Cart Total</h4>
<table class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<th scope="col">#</th>
<th scope="col">Product</th>
<th scope="col">Price</th>
<th scope="col">Quantity</th>
<th scope="col">Total</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Lorem Ipsum</td>
<td>1400</td>
<td><input class="form-control form-control-sm" type="number" value="1"></td>
<td>1400</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Dolor Sit Amet</td>
<td>425</td>
<td><input class="form-control form-control-sm" type="number" value="2"></td>
<td>850</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Lorem Lorem</td>
<td>850</td>
<td><input class="form-control form-control-sm" type="number" value="1"></td>
<td>850</td>
</tr>
</tbody>
</table>
</div>
</div>
I think its better to use Table layout or Display Flex or Grid layout.
All the theories below are from w3school,
Table Layout:
The table-layout property defines the algorithm used to lay out table cells, rows, and columns.
The main benefit of table-layout: fixed; is that the table renders much faster. On large tables, users will not see any part of the table until the browser has rendered the whole table. So, if you use table-layout: fixed, users will see the top of the table while the browser loads and renders rest of the table. This gives the impression that the page loads a lot quicker!
Display Flex:
Click here
HTML:
<div> // display:flex, flex-direction:column, justify-content:space-around
<div> // display:flex, flex-direction:row, justify-content:space-around
<div> </div>
<div> </div>
</div>
<div> // display:flex, flex-direction:row, justify-content:space-around
<div> </div>
<div> </div>
</div>
</div>
Grid Layout:
Link here
The CSS Grid Layout Module offers a grid-based layout system, with rows and columns, making it easier to design web pages without having to use floats and positioning.
My choice:
There are always different approaches to do a thing, but in the situation, you mention I would prefer to go with display: flex method.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I have a database with lots of records and I have to make a foreach loop in order to get all that data. The problem is that a chart for every data would overload the page. So I need to make a barlike chart using two divs and one div(the blue one) to take percentage of the main one (the grey div) accourding to the value from that data. I did all of that but I don't know how to make the inner div build change it's percentage width according to how close it is from the highest value in my database. This is how I fetch the numbers shown in the right.
<?php echo #$item->{"media_count"}; ?>
I will attach an image so you can see how I need to make it look like.
barlike chart
<table class="table table-bordered">
<tbody style="width: 401px; border: 0;">
<?php foreach ($data->data->data as $key => $item):
if (#$item->{"name"}) {
?>
<tr>
<td>
<?php echo #$item->{"name"}; ?>
</td>
<td>
<div class="outer">
<div class="inner" style="width: 20%;"></div>
</div>
</td>
<td>
<?php echo #$item->{"media_count"}; ?>
</td>
</tr>
<?php }
endforeach ?>
</tbody>
</table>
Is this the sort of layout you are looking for?
.outer, .inner {
height: 20px;
margin-bottom: 5px;
}
.outer {
background-color: gray;
width: 200px;
}
.inner {
background-color: blue;
}
<div class="outer">
<div class="inner" style="width: 20%;"></div>
</div>
<div class="outer">
<div class="inner" style="width: 40%;"></div>
</div>
<div class="outer">
<div class="inner" style="width: 60%;"></div>
</div>
Create a full width div, set the height and width and color it gray. Then, inside that div, create another div with no margin, set the height and color it blue. Set the width of the blue div to the width that you want it.
You could use absolute positioning for the bars inside a relatively positioned div to make the bars follow the outer div.
.outerGraph {
position: relative;
width: 400px;
height: 200px;
background-color: #fff;
}
.value {
position: absolute;
height: 20px;
right: 10px;
}
.bar {
position: absolute;
background-color: blue;
height: 20px;
left: 10px;
}
.bar1 {
top: 10px;
}
.bar2 {
top: 40px;
}
.bar3 {
top: 70px;
}
<div class="outerGraph">
<div class="bar bar1" style="width: 75px;" title="88204"></div>
<div class="value bar1">88204</div>
<div class="bar bar2" style="width: 100px;" title="92784"></div>
<div class="value bar2">92784</div>
<div class="bar bar3" style="width: 200px;" title="100000"></div>
<div class="value bar3">100000</div>
</div>
Use the title attribute on the bars for the hover effect and apply the bar[] class for both bars and their numbers.
Honestly, I cannot think of a reason you shouldnt just use javascript; you should tell us why you want this and post some code of your own
I am using a table to display information from my database but I'm having trouble formatting the CSS. Right now I have 12 icons and the respective name on the right and the problem is that everything is displayed like a list, one below the other and I wanted to break the list in three blocks, like this:
EDIT I don't need necessarily to do it with tables, I just need to display the values like this, dynamically. Because later I'd probably going to add more plants to database and I want them to be always listed like this.
This is my html:
<table id="plantslist">
<?php
foreach($resultado as $planta){ ?>
<tr>
<td><img src="http://www.coisas.pt/coisas/backoffice/<?php echo $planta['icon']; ?>"></img></td>
<td><a href="blabla.php?name=<?php echo $planta['name']?>&img=<?php echo $planta['img']?>&tagline=<?php echo $planta['tagline']?>&hum=<?php echo $planta['hum']?>&lum=<?php echo $planta['lum']?>&temp=<?php echo $planta['temp']?>&seed=<?php echo $planta['seed']?>&spacing=<?php echo $planta['spacing']?>&info1=<?php echo $planta['info1']?>&info2=<?php echo $planta['info2']?>&info3=<?php echo $planta['info3']?>&info4=<?php echo $planta['info4']?>">
<?php echo $planta['name'];?></a></td>
</tr>
<?php } ?>
</table>
CSS:
#plantslist {
border: 3px solid white;
overflow: scroll;
font-size: 1.7vw;
line-height: 2.8vw;
font-family: Robotomedium;
margin-top: 11%;
text-align: left;
}
#plantslist img {width: 2.3vw;}
#plantslist tr td {
display: inline-block;
vertical-align: top;
}
You can do a container with width: 100%; then make child elements with width: 33% each one. To make them place one next to other you can use float: left;. Here is an example.
.table {
width: 100%;
float: left;
}
.table > .items {
width: 33%;
float: left;
}
.table > .items:before {
content: "";
display: block;
background: url(http://placehold.it/20/000) no-repeat;
width: 20px;
height: 20px;
float: left;
margin: 0 6px 0 0;
}
<div class="table">
<div class="items">1</div>
<div class="items">2</div>
<div class="items">3</div>
<div class="items">4</div>
<div class="items">5</div>
<div class="items">6</div>
<div class="items">7</div>
<div class="items">8</div>
<div class="items">9</div>
</div>
Look that your icon it's placed with before pseudo element. You should change background value with the correct url.
EDIT
Use this if you have different images per plant.
.table {
width: 100%;
float: left;
}
.table > .items {
width: 33%;
float: left;
}
.table > .items img {
width: 20px;
height: 20px;
margin: 0 10px 0 0;
float: left;
}
<div class="table">
<div class="items">
<img src="http://placehold.it/20/dfa9a9" alt=""> 1
</div>
<div class="items">
<img src="http://placehold.it/20/dfa9de" alt=""> 2
</div>
<div class="items">
<img src="http://placehold.it/20/b1a9df" alt=""> 3
</div>
<div class="items">
<img src="http://placehold.it/20/a9cadf" alt=""> 4
</div>
<div class="items">
<img src="http://placehold.it/20/dfd8a9" alt=""> 5
</div>
<div class="items">
<img src="http://placehold.it/20/5cff46" alt=""> 6
</div>
<div class="items">
<img src="http://placehold.it/20/dfa9a9" alt=""> 7
</div>
<div class="items">
<img src="http://placehold.it/20/a9cadf" alt=""> 8
</div>
<div class="items">
<img src="http://placehold.it/20/a9cadf" alt=""> 9
</div>
</div>
Using your PHP code
HTML | PHP
<div class="table">
<?php
foreach($resultado as $planta){
?>
<div class="items">
<img src="http://www.growbox.pt/growbox/backoffice/<?php echo $planta['icon']; ?>" alt="<?php echo $planta['name'];?>">
<a href="intips.php?name=<?php echo $planta['name']?>&img=<?php echo $planta['img']?>&tagline=<?php echo $planta['tagline']?>&hum=<?php echo $planta['hum']?>&lum=<?php echo $planta['lum']?>&temp=<?php echo $planta['temp']?>&seed=<?php echo $planta['seed']?>&spacing=<?php echo $planta['spacing']?>&info1=<?php echo $planta['info1']?>&info2=<?php echo $planta['info2']?>&info3=<?php echo $planta['info3']?>&info4=<?php echo $planta['info4']?>"><?php echo $planta['name'];?>
</a>
</div>
<?php
}
?>
</div>
CSS
.table {
width: 100%;
float: left;
}
.table > .items {
width: 33%;
float: left;
}
.table > .items img {
width: 20px;
height: 20px;
margin: 0 10px 0 0;
float: left;
}
See if this works. I'm just creating more elements so that you have 3 sets of tds per row. Ideally, though, I wouldn't do this with tables. I'd do something like arglab suggested with divs, but here I'm just showing you how I'd do it with tables since that was your question. Make your divs inline blocks with width 33% and you should be good. You may also need to do box-sizing: border-box so that way any padding and margins get automatically put into the calculation for you.
<table id="plantslist">
<?php $count = 0; ?>
<tr>
<?php foreach($resultado as $planta) {
if (count === 2) {
count = 0; ?>
<td><img src="http://www.growbox.pt/growbox/backoffice/<?php echo $planta['icon']; ?>"></img></td>
<td><a href="intips.php?name=<?php echo $planta['name']?>&img=<?php echo $planta['img']?>&tagline=<?php echo $planta['tagline']?>&hum=<?php echo $planta['hum']?>&lum=<?php echo $planta['lum']?>&temp=<?php echo $planta['temp']?>&seed=<?php echo $planta['seed']?>&spacing=<?php echo $planta['spacing']?>&info1=<?php echo $planta['info1']?>&info2=<?php echo $planta['info2']?>&info3=<?php echo $planta['info3']?>&info4=<?php echo $planta['info4']?>">
<?php echo $planta['name'];?></a></td>
</tr>
<tr>
<?php }
else {
$count += 1;
// If this doesn't work, try $count = $count + 1;
<td><img src="http://www.growbox.pt/growbox/backoffice/<?php echo $planta['icon']; ?>"></img></td>
<td><a href="intips.php?name=<?php echo $planta['name']?>&img=<?php echo $planta['img']?>&tagline=<?php echo $planta['tagline']?>&hum=<?php echo $planta['hum']?>&lum=<?php echo $planta['lum']?>&temp=<?php echo $planta['temp']?>&seed=<?php echo $planta['seed']?>&spacing=<?php echo $planta['spacing']?>&info1=<?php echo $planta['info1']?>&info2=<?php echo $planta['info2']?>&info3=<?php echo $planta['info3']?>&info4=<?php echo $planta['info4']?>">
}
?>
</table>
SOLUTION WITH DIVS: See if this works...
<div id="plantslist">
<?php foreach($resultado as $planta) { ?>
<div class="plant">
<img src="http://www.growbox.pt/growbox/backoffice/<?php echo $planta['icon']; ?>"></img>
<a href="intips.php?name=<?php echo $planta['name']?>&img=<?php echo $planta['img']?>&tagline=<?php echo $planta['tagline']?>&hum=<?php echo $planta['hum']?>&lum=<?php echo $planta['lum']?>&temp=<?php echo $planta['temp']?>&seed=<?php echo $planta['seed']?>&spacing=<?php echo $planta['spacing']?>&info1=<?php echo $planta['info1']?>&info2=<?php echo $planta['info2']?>&info3=<?php echo $planta['info3']?>&info4=<?php echo $planta['info4']?>">
<?php echo $planta['name'];?></a>
</div>
<?php } ?>
</div>
CSS
#planstslist{
width: 100%;
/* this may help if the items don't stack properly */
white-space: nowrap;
}
.plant{
width: 33.33%
display: inline-block;
/* this may help if the items don't stack properly */
white-space: normal;
}
You may need to make the images inline blocks and set them and the links to have percentage width values adding up to no more than 100%. You may also need to add box-sizing: border-box; to the "plant" divs. I usually get in the habit of making the following declaration on all my CSS files: * {box-sizing: border-box};
I think it's enough if you simply erase display: inline-block; from this CSS rule;
#plantslist tr td {
display: inline-block;
vertical-align: top;
}
displayshould be table-cell, not inline-block, which is the default anyway in a <td> element. Also vertical-align: top; wouldn't be necessary, so you might as well erase the whole rule...
this is my fiddle with html and css: http://jsfiddle.net/v2r5we0r/
I'm trying to show a DIV "station_info"(shape of a square) when either clicked/hovered on those DIVs "boxes" right next to it (it will have information from my database table that I will put later on).
I have my PHP posted since I'm looping through my DB to create those boxes.
Is it possible using only CSS and HTML? If so, how can i? I only find examples with Jquery, I don't want to use JQuery or Javascript.
Scroll down the Result in fiddle to see the smalss boxes
Thank you in advance.
HTML:
<body>
<div id="map_size" align="center">
<div class='desk_box' style='position:absolute;left:20px;top:1230px;'>id:84
<div class='station_info'>Hello</div></div>
</div> <!-- end div map_Size -->
</body>
CSS:
/*body*/
body{
margin:0px auto;
width:80%;
height:80%;
}
/*map size*/
#map_size{
width:1190px;
height:1300px;
background:#0099FF;
border-style: solid;
border-color: black;
position: relative;
}
/* desk boxes*/
.desk_box{
width: 23px;
height: 10px;
border: 4px solid black;
padding:10px;
}
.desk_box > .station_info{
display:none;
}
.desk_box > .station_info:first-child{
display:block;
}
.desk_box > div:hover + div {
display: block;
}
PHP:
<?php
include 'db_conn.php';
//query to get X,Y coordinates from DB
$coord_sql = "SELECT coordinate_id, x_coord, y_coord FROM coordinates";
$coord_result = mysqli_query($conn,$coord_sql);
//see if query is good
if($coord_result === false) {
die(mysqli_error());
}
?>
<div id="map_size" align="center">
<?php
//get number of rows for X,Y coords in the table
while($row = mysqli_fetch_assoc($coord_result)){
//naming X,Y values
$x_id = $row['coordinate_id'];
$x_pos = $row['x_coord'];
$y_pos = $row['y_coord'];
//draw a box with a DIV at its X,Y coord
echo "<div class='desk_box' style='position:absolute;left:".$x_pos."px;top:".$y_pos."px;'>id:".$x_id."<div class='station_info'>Hello</div></div>";
} //end while coord_result loop
?>
</div>
CSS can only work descending or going further in the same level in the DOM tree, so you'll have to put the div you wanna hide/show on hover AFTER all the DIVs you're going to hover. Then you can use the general sibling operator: ~ which looks for elements AFTER a given element.
Say you have
.toto ~ .titi {}
then those <div class="titi"> will match
<div class="toto"><div>
<div class="titi"></div>
Or
<div class="toto"></div>
<div class="whatever"></div>
<div class="titi"></div>
But this one won't
<div class="titi"></div>
<div class="toto"></div>
Here's a snippet to see if this is what you want.
/*body*/
body{
margin:0px auto;
width:80%;
height:80%;
}
/*map size*/
#map_size{
width:1190px;
height:1300px;
background:#0099FF;
border-style: solid;
border-color: black;
position: relative;
}
/* desk boxes*/
.desk_box{
width: 23px;
height: 10px;
border: 4px solid black;
padding:10px;
}
.desk_box > .station_info{
display:none;
}
.desk_box > .station_info:first-child{
display:block;
}
.desk_box > div:hover + div {
display: block
}
.div-to-show {
display: none;
}
.desk_box:hover ~ .div-to-show {
display: block;
}
<div id="map_size" align="center">
<div class='desk_box' style='position:absolute;left:20px;top:1230px;'>id:84<div class='station_info'>Hello</div></div>
<div class='desk_box' style='position:absolute;left:20px;top:1165px;'>id:85<div class='station_info'>Hello</div></div>
<div class='desk_box' style='position:absolute;left:20px;top:1100px;'>id:86<div class='station_info'>Hello</div></div>
<div class='desk_box' style='position:absolute;left:20px;top:1035px;'>id:87<div class='station_info'>Hello</div></div>
<div class='desk_box' style='position:absolute;left:73px;top:1230px;'>id:92<div class='station_info'>Hello</div></div>
<div class="div-to-show" style="position: absolute; left:150px; bottom: 100px;">Oh hi !</div>
</div> <!-- end div map_Size -->
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
Here is the HTML code of the container
?>
<div class="right_nav" >
<div class="right_nav_top">
Your Cart
</div>
<hr width="130px">
<table width="167" border="0" cellpadding="0" cellspacing="0" style="font-size:12px; margin:5px; overflow:auto">
<?php
//iterate through the cart, the $product_id is the key and $quantity is the value
foreach($_SESSION['cart'] as $product_id => $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) > 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
?>
<tr>
<td colspan="3"><?php echo $name;?></td>
</tr>
<tr>
<td width="31"><?php echo $quantity;?>x</td>
<td width="59">£<?php echo $line_cost?></td>
<td width="70">
<a href="<?php Site_titte();?>/viewcart.php?action=add&id=<?php echo $product_id;?>" title="Add">
<img src="<?php Site_titte();?>/images/addred.png" width="24" height="24" border="none">
</a>
<a href="<?php Site_titte();?>/viewcart.php?action=remove&id=<?php echo $product_id;?>" title="Remove">
<img style="margin-bottom:6px;" src="<?php Site_titte();?>/images/icon_close.png" border="none"></a></td>
</tr>
<?php }}?>
</table>
<?php
if(!isset($_SESSION['uid']))
{$link="login.php";}
else
{$link=Site_titte()."/order.php";}
?>
<hr width="130px">
<div class="total_main">
<div class="total_p1">Total</div>
<div class="total_p2">£<?php echo $total ?></div>
<div class="clearfix"></div>
</div>
<br>
<center>
<a href="<?php echo $link;?>">
<img src="<?php Site_titte();?>/images/btn_order.png" border="none" width="140" height="38">
</a>
</center>
</div>
<?php
}
else {
?>
<div class="right_nav2">
<div class="right_nav_top2">
Your Cart
</div>
<hr width="130px">
<table border="0" cellpadding="0" cellspacing="5" style="font-size:14px; margin:5px;">
<tr>
<td colspan="3">Your cart is empty.</td>
</tr>
</table>
and this is the css 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;}
Please help me where should I edit to add a scrollbar in this container
You can add overflow-y or overflow-x to achieve this depending on which direction you want to scroll. I'm guessing you want to scroll up and down. So when your div increases in content (products) past it's limits, a scroll bar will appear for the div. See the example below:
Example:
<!-- Scroll bar present but disabled -->
<div style="width: 200px; height: 100px; overflow-y: scroll;">
test
</div>
<!-- Scroll bar present and enabled -->
<div style="width: 200px; height: 100px; overflow-y: scroll;">
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
</div>
add
overflow:scroll
to the to the element you want to have the scroll bar.