Creating css scrollable table with fixed header - css

I have a little problem since 2 weeks ago and I was searching through the internet and this site over and over but none of the current solutions seem to do the trick.
I am trying to upgrade a web application (actually only the design of it). I have a non scrollable table which was programmed from another person that needs to serve as data entry for large amount of relations and products. The problem is the visibility of the header which I want to make fixed, but the table to be scrollable. I have tried css codes like position:absolute, or overflow:scroll etc.. but none of them seem to add scrollbar on the right side of the table. If there is anyone that can help even a little bit would be greatly appreciated. Here is the code I have so far:
/* TABLE
----------------------------------------------------------*/
/*table { table-layout: fixed; }*/
/*.th, .td { width: 30; break-word: word-wrap;}*/
.table
{
table-layout: fixed;
overflow: hidden;
border:solid;
border-width:thin;
border-bottom-style:solid;
border-color:Black;
table-layout:fixed;
border-collapse:collapse;
background-color:White;
}
.tBody
{
margin-top:196px;
}
.tdVisible
{
/*font-weight:normal;*/
color:Black;
border-spacing:0px;
border:solid;
border-width:thin;
background-color: rgb(229,229,239);
break-word: word-wrap;
}
.tdHeader
{
width:40px;
break-word: word-wrap;
/*min-width:150px;*/
min-width:30px;
min-height:60px;
/*width:150px;
height:126px;*/
border:solid;
border-width:thin;
font-weight:normal;
font-size:12px;
/*position:fixed;*/
overflow:hidden;
z-index:100;
margin-left: -2px;
margin-top: -2px;
}
.tdRow
{
/*width:20px;
break-word: word-wrap;*/
height:20px;
max-height:22px!important;
}
.tdRowLast
{
font-weight:bold!important;
text-align:right!important;
}
.tdLongID
{
/*width:60px;
min-width: 60px;
max-width:60px;*/
width:60px;
min-width:60px;
max-width:60px;
border:solid;
border-width:thin;
}
.tdItemName
{
/*width:315px;
min-width:315px;*/
width:250px;
min-width:250px;
border:solid;
border-width:thin;
}
.tdShortID
{
width:20px;
border:solid;
border-width:thin;
min-width:20px;
max-width:20px;
}
.tdCol
{
/*width:94px;*/
width:40px;
break-word: word-wrap;
border:solid;
border-width:thin;
font-weight:normal!important;
padding-left: 1px;
padding-right: 0px;
}
.tdData
{
height:20px;
border:solid;
border-width:thin;
}
.tdInside
{
width:20px;
border:solid;
border-width:thin;
background-color: rgb(229,229,229);
padding-left:1px;
padding-right:1px;
text-align:center;
break-word: word-wrap;
}
So there is actually a Javascript that creates the table reading from database in order to make it with the right clients and products. The only thing I'm trying to change is the table header to stay in one place and me to be able to scroll down the table while viewing it on screen all the time.
Hope to get some help from you.

With thead and tbody that should works :
Here a fiddle to start

Related

Make each span element farther from rest, except one

I want to be able to write a style in less, where I can apply it to 4 span tags. I want each span to have all the same properties, but I want to have be 30px; of space between each one. An finally, I want the 2nd span to have a different distance from the right than all the others.
Is there a way to do this, or do you need to write a separate style for span 2?
So here is my style for each span, which works fine. But there must be a better way with less...??
.right-lines {
z-index:100;
display:block;
position:absolute;
width:80px;
height:2px;
background-color:#fff;
right:-80px;
margin:40px;
top:140px;
}
.right-lines2 {
z-index:100;
display:block;
position:absolute;
width:80px;
height:2px;
background-color:#fff;
right:-50px;
margin:40px;
top:180px;
}
.right-lines3 {
z-index:100;
display:block;
position:absolute;
width:80px;
height:2px;
background-color:#fff;
right:-80px;
margin:40px;
top:220px;
}
.right-lines4 {
z-index:100;
display:block;
position:absolute;
width:80px;
height:2px;
background-color:#fff;
right:-80px;
margin:40px;
top:260px;
}
If you want the lines to be 30px from one another, use 30px of margin. There is no need for so much absolute positioning. This also allows for fewer specific styles.
body {
background: black;
}
.right-lines {
position: absolute;
top: 140px;
right: 0;
z-index: 100;
font-size: 0;
text-align: right;
}
.right-lines span {
display: block;
width: 80px;
height: 2px;
background-color: #fff;
margin: 0 80px 30px auto;
}
.right-lines span:nth-of-type(2) {
margin-right: 50px;
}
.right-lines span:last-child {
margin-bottom: 0;
}
<div class="right-lines">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
Try making a common class or use the span tag itself to style the common features. You can, of course get even more efficient with other class stylings. And a sample span tag might look like <span class="span_class right-lines">...</span>
/* common styles */
.span_class {
z-index:100;
display:block;
position:absolute;
width:80px;
height:2px;
background-color:#fff;
margin:40px;
}
/* And now make the special ones */
.right-lines {
right:-50px;
top:180px;
}
.right-lines2 {
right:-50px;
top:180px;
}
.right-lines3 {
right:-80px;
top:220px;
}
.right-lines4 {
right:-80px;
top:260px;
}

css under line two color

I am trying to add two different color underline in same text but not able to set 2nd underline its gone down from the first line.
Here is the link example "click here for exmple"
check the title's underline of this page Other Meetings , Church Services.
.zaptitle {
margin-bottom:20px !important;
}
.home_widget .page_title_s2, .home_widget .page_title_s3, .home_widget .page_title_s4,
.page_title_testimonials, .zaptitle {
border-bottom-color:#EDEDED;
border-bottom-style:solid;
border-bottom-width:1px;
color:#545454;
float:left;
font-family:Arial, sans-serif;
font-size:16px;
font-weight:bold;
margin:0 0 20px;
min-height:30px;
padding:0;
position:relative;
width:100%;
}
And
<div class="zaptitle page_title_s2 ">
<span class="page_info_title_s2" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(16, 185, 185);">Latest News</span>
</div>
The beauty about CSS is that things don't really have to be like they seem to be. You can create such a line using other elements.
JSfiddle
HTML:
<div id="hello">hello</div>
<div id="left_line"></div>
<div id="right_line"></div>
CSS:
#left_line {
background-color:black;
margin-right:90%;
float:left;
width:10%;
height:1px;
}
#right_line {
background-color:red;
float:right;
width:80%;
height:1px;
position:absolute;
left:10%;
}
Please add the following code in your existing CSS:--
.page_info_title_s2{
position: relative;
float: left;
padding-bottom: 10px;
line-height: 20px;
top: 1px;
vertical-align: baseline;
}
use above code to exact line overwriting. See the working fiddle:--
http://jsfiddle.net/npsingh/RgE2h/1/
you just need to add this class
.page_info_title_s2{
display:block;
float:left;
min-height:30px;
}
this is working Fiddle

Add CSS positioning to buttons

I have a previous and a next button for a php pagination script, which both fall under the class paginate.
.paginate {
font-family:Arial, Helvetica, sans-serif;
padding: 3px;
width:400px;
}
.paginate a {
padding:2px 5px 2px 5px;
margin:2px;
text-decoration:none;
color: #fff;
width: 180px;
}
so i have given them both their own individual classes Next and previous
Next
.next {
background: url("../images/more.fw.png") no-repeat;
height: 87px;
width:128px;
padding:10px;
margin:50px;
font-family:Arial;
font-size:24px;
color:#fff;
position:fixed;
top:585px;
right:470px;
}
Previous
.previous {
background: url("../images/previous.fw.png") no-repeat;
height: 87px;
width:128px;
padding:10px;
margin:50px;
font-family:Arial;
font-size:24px;
color:#fff;
position:fixed;
top:585px;
right:620px;
}
As you can see in the link below these buttons fit perfectly side by side when set against the top of the page, however what i am trying to do is get the buttons to sit say 20 px below the section above. However if i change ti from top 558px, what happens is the buttons sit at different heights and will not sit next to one another.
Any ideas would be appreciated.
Thanks
you can set the button by position:absolute; on both the .next and .previous so that the potion of button wont change
You have the style set to position: fixed, so they wont move when the screen scrolls - is this what you want?
.paginate {
position: relative;
...
.next {
position: absolute;
display: block;
...
Now set your button top and right all relative to the paginate container

How can I give this CSS an inner border?

I am trying to give the #page div an inner border that is in line with the grey border around the top part: http://www.designated.net.au/testbed/testpage/
I realise I could just add another div, but that is not the solution I'm looking for as there will be other content within #page. Is this possible?
This follows on from this question: Border-box CSS not working properly
If you don't mind it not working in older browsers you could just use a .box-shadow. This can be done without having to add extra markup. You could also use :before or :after pseudo css classes as well but box-shadow is cleaner IMO.
-webkit-box-shadow(inset 0 0 1px #000);
-moz-box-shadow(inset 0 0 1px #000);
-o-box-shadow(inset 0 0 1px #000);
box-shadow(inset 0 0 1px #000);
You can leverage the relative positioning you are already using to align your images with the border.
Example: http://jsfiddle.net/zbrcb/
Merge these definitions with your existing definitions.
#page {
border: 10px solid #333;
}
#spotlight-main-top-left { z-index:3; position:relative; float:left; width:40px; height:40px; left: -10px; top: -10px; }
#spotlight-main-top-top { z-index:2; position:relative; width:100%; height:10px; background-color:#333333; top: -10px; }
#spotlight-main-top-right { z-index:3; position:relative; float:right; width:40px; height:40px; right: -10px; top: -10px; }
#spotlight-main-top-title { z-index:3; position:relative; margin:0 auto; width:200px; height:30px; top: -10px; }
#spotlight-main-top-title-left { position:relative; float:left; width:30px; height:30px; }
#spotlight-main-top-title-right { position:relative; float:right; width:30px; height:30px; }
#spotlight-main-top-title-middle { position:relative; margin:0 30px 10px; width:140px; height:20px; background-color:#333333; }
#spotlight-main-top-title-text { position:relative; width:140px; height:18px; text-align:center; }
​Works in Chrome, FF, Safari, IE 8/9 (7 could probably be made to work as well; your header is misaligned in IE7 even without this change).
Personally, I would try to reduce the number of elements you are using to create the top of the site, but to be fair it works fine.

making a webpage cross browser compatible

i want to display my webpage in all the browser versions...my code is working fine in mozilla and chrome but not working properly in internet explorer.
here is the css code which is not compatible with IE it's seems....
EDIT
Struggling to create a web page for cross browser and multiple resolution support for the past 2 months,As my design have multiple issues with resolution and browser support.i am new to this designing thing and i dont have any idea on how to this.i saw a article regarding multiple resolution support which states that we have to use regular css code which is supported by all the browsers under all resolutions.Also i heard that we have to put our normal <div></div> inside a container,so that the design will never collide which each other when it is viewed under lower resolution.below is my css code which will work under 1680X1050 and only in Mozilla.currently iam using a template which works fine under all circumstances.give me some sample examples of a perfect design so that i will learn to design my own
#image img
{
padding:6px;
border-top:0px solid #ddd;
border-left:0px solid #ddd;
border-bottom:0px solid #c0c0c0;
border-right:0px solid #c0c0c0;
display:inline;
position:relative;
top:-210px;
margin-left:auto;
margin-right:auto;
}
#hori
{
width: 70em;
margin-left:350px;
position:absolute;
}
#hori ul li
{
display:inline;
float:left;
list-style:none;
}
#hori ul
{
padding:0;
margin-top:-620px;
}
#hori li
{
display: inline;
padding:0;
text-align:center;
width:7em;
float:left;
list-style:none;
height:25px;
margin-left:15px;
background:#38ACEC;
-moz-border-radius: 70px;
border-radius: 70px;
}
#verti
{
float:bottom;
width:200px;
margin-top:50px;
position:relative;
display: inline;
}
#verti ul li
{
list-style:none;
text-decoration:none;
}
#verti ul
{
padding:0;
margin:0;
}
#verti li
{
width:150px;
background:#38ACEC;
margin-bottom:9px;
position:relative;
top:170px;
-moz-border-radius:80px;
border-radius:80px;
text-align:center;
}
#slideshow
{
position:relative;
height:500px;
right:-570px;
top:-280px
}
#slideshow img
{
position:absolute;
top:0;
left:0;
z-index:8;
}
#slideshow img.active
{
z-index:10;
}
#slideshow img.last-active
{
z-index:9;
}
table,th,td
{
border:1px solid black;
width:650px;
position:relative;
right:-480px;
margin-top:-35%;
}
th
{
background-color:#38ACEC;
color:white;
}
Since you didn't ask any question may I presume the question is: how should I make this css compatible in IE browsers?
There are actually several ways to do this:
Find out wich css properties are not functioning correct in IE check this site for some common CSS mistakes http://www.webcredible.co.uk/user-friendly-resources/css/internet-explorer.shtml
Add an inline filter to render different css when using IE followed with the IE compatible css if you want to make this negative just add ! before the condition.
make 2 different css files wich are included in the top of your html page with the same filter
<!--[if lt IE #version]>
<link rel="stylesheet" type="text/css" href="styleIE.css" />
hope this helps you out.

Resources