CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 6th, 2003, 04:09 AM
pradeepr pradeepr is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 2 pradeepr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How to know whether there is overflow in CSS

Is there any way to find the overflow in CSS?

I have two table using two different style.
1. Header text
2.Data



I have scenario where size of table which has data may increase or decrease based upon resultset.
I am using "overflow:auto",so that vertical bar will appear when data is huge in table,so that user can see all the records.

This creates a problem in alignment of header and databody when there is no scroll bar.As width of databody moves with a little (width=scrollbar) to the right and mismatch with the header

If scrollbar appears alignement is OK between header and content as scrollbar appears sidewise with content.

Try running the exmple mentioned below for both option

1.Without scrollbar

<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
div.head
{
background-color: #FFFFCC;
border: 1px solid #000000;
position: absolute;
height: 25px;
width: 385px;
left: 50px;
top: 22px;
}
div.scroll {
background-color: #FFFFCC;
border: 1px solid #000000;
overflow-y: auto;
position: absolute;
height: 100px;
width: 400px;
left: 50px;
top: 50px;
}

</style>
</head>
<body>
<div class="head">
<table width="100%" border="1" cellspacing="0" cellpadding="2">
<tr>
<td>Header1</td>
<td>Header2</td>
</tr>
</table>

</table>
</div>
<div class="scroll">
<table width="100%" border="1" cellspacing="0" cellpadding="2">
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
</table>
</div>
</body>
</html>


2. With Scroll bar

<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
div.head
{
background-color: #FFFFCC;
border: 1px solid #000000;
position: absolute;
height: 25px;
width: 385px;
left: 50px;
top: 22px;
}
div.scroll {
background-color: #FFFFCC;
border: 1px solid #000000;
overflow-y: auto;
position: absolute;
height: 100px;
width: 400px;
left: 50px;
top: 50px;
}
</style>
</head>
<body>
<div class="head">
<table width="100%" border="1" cellspacing="0" cellpadding="2">
<tr>
<td>Header1</td>
<td>Header2</td>
</tr>
</table>
</table>
</div>
<div class="scroll">
<table width="100%" border="1" cellspacing="0" cellpadding="2">
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
<tr>
<td>content</td>
<td>content</td>
</tr>
</table>
</div>
</body>
</html>


How can I rectify the same any suggestion.

Reply With Quote
  #2  
Old August 6th, 2003, 08:35 AM
icy_polecat's Avatar
icy_polecat icy_polecat is offline
Senior Polecat
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Jersey (the original version)
Posts: 210 icy_polecat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 57 sec
Reputation Power: 6
Send a message via Yahoo to icy_polecat
you could always turn overflow to scroll regardless of whether its needed or not.
__________________
Quidquid latine dictum sit, altum viditur.

http://www.XSet.co.uk

Reply With Quote
  #3  
Old August 6th, 2003, 10:56 PM
pradeepr pradeepr is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 2 pradeepr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
My requirement is that I should show scroll bar when more data is available.

If I use scroll I will be getting scrollbar with disabled option if data fits in the window.

Reply With Quote
  #4  
Old August 7th, 2003, 03:18 AM
icy_polecat's Avatar
icy_polecat icy_polecat is offline
Senior Polecat
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Jersey (the original version)
Posts: 210 icy_polecat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 57 sec
Reputation Power: 6
Send a message via Yahoo to icy_polecat
yeah but it solves your alignment problem!

the only other thing I can think of is testing against the editable width of the div with javascript but that would have to be DOM scripted - i don't think there are global functions to do this.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > How to know whether there is overflow in CSS


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway