Adding text below a table in a container - html

Given the following HTML, which produces a list of charity donors and a title at the top. I'd like to add the name of the Charity at the bottom within the container.
I'm new with HTML and beginner so doing this as my first task.
CSS CODE:
/*** central column on page ***/
div #divContainer {
max-width: 50%;
margin: 0 auto;
font-family: Verdana;
padding: 1em 1em 1em 1em;
/* rounded corners */
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
/* add gradient */
background-color: #908080;
background: -webkit-gradient (linear, left top, left bottom, from(#606060), to(#C65C65));
background: -moz-linear-gradient (top, #606060, #998880);
/* add box shadows */
-moz-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.3);
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.3);
}
/*** Donner Role ***/
table.CRG {
align="center";
vertical-align="center";
text-align:center;
border:3px solid black;
border-collapse:collapse;
}
/*** table's td element, all section ***/
table.CRG td {
color:white;
vertical-align:middle;
padding: 0.5em;
border:3px solid black;
font-weight:bold;
}
h1 {
color:#FFE47A;
font-size:1.5em;
}
HTML CODE:
<!-- CENTTERED COLUMN ON THE PAGE-->
<div id="divContainer">
<!-- HTML5 TABLE FORMATTED VIA CSS3-->
<table class="CRG" width="100%">
<!-- TABLE BODY: MAIN CONTENT from Function CRG -->
<tbody>
<h1>
<center> My Charity </center>
</h1>
<tr>
<td>Mr. Smithn</td>
</tr>
<tr>
<td>Mr. Jones</td>
</tr>
<tr>
<td>Mrs. Generous</td>
</tr>
<tr>
<td>Reserved</td>
</tr>
<tr>
<td>Reserved</td>
</tr>
<tr>
<td>Reserved</td>
</tr>
<tr>
<td>Reserved</td>
</tr>
<tr>
<td>Reserved</td>
</tr>
</tbody>
</table>
</div>
Any help would be appreciated!

There are so many ways that this might be handled...too numerous to put in one post. Here are just some general ideas. Though your data are "tabular" I won't focus on tables, but other options - alluding to the "old saw" - don't use tables for layout, use them for tabular data.
divs, using classes or pseudoclasses:
<div class='headerdiv'></div>
<div class='donordiv'></div>
<div class='donordiv'></div>
<div class='donordiv'></div>
<div class='donordiv'></div>
<div class='donordiv'></div>
<div class='donordiv'></div>
<div class='footerdiv'></div>
Unnumbered lists - styling using classes or pseudoclasses.
<ul>
<li class='headerlist'>
<ul>
<li class='donor'>donor1</li>
<li class='donor'>donor2</li>
<li class='donor'>donor3</li>
<li class='donor'>donor4</li>
</ul>
</li>
<li class='footerstuff'>footer stuff</li>
</ul>
If you like dls, dts etc, again styling with css classes or pseudoclasses.
<dl>
<dt>Title</dt>
<dd>donor 1</dd>
<dd>donor 2</dd>
<dd>donor 3</dd>
<dd>donor 4</dd>
<dt>Stuff</dt>
</dl>
And I'll bet there are many other ways that the experts will show us.

Related

Link not working in table

I'm making this site for my friends mom and for some reason my links aren't working in my table, I have reason to believe that it has something to do with the CSS, also I've never had this problem before so I'm not fully sure how to fix it. The code works in Chrome but not Firefox also to clarify, I can't click on the link, it turns it blue and underlines it but I just generally can't click on it at all.
HTML
<nav>
<table id="nav_table">
<tr>
<td class="nav_border">
<p class="nav_options">Home</p>
</td>
<td class="nav_border">
<p class="nav_options">Restaurants</p>
</td>
<td class="nav_border">
<p class="nav_options">Near you</p>
</td>
<td class="nav_border">
<p class="nav_options">Order Here!</p>
</td>
</tr>
</table>
</nav>
CSS
nav{
position: relative;
top: 50px;
}
#nav_table{
position: relative;
top: 60px;
margin-left:auto;
margin-right:auto;
border-spacing: 5px 0px;
border-collapse: ;
height: 0px;
}
.nav_border{
text-align: center;
border: 2px solid black;
padding: 10px;
width: 120px;
height: 0px;
-webkit-box-shadow: rgb(,,) 0px 0px 0px ;
-moz-box-shadow: rgb(,,) 0px 0px 0px ;
box-shadow: rgb(,,) 0px 0px 0px ;
background:-webkit-radial-gradient(center,circle,red 0%, orange 50%);
background:-moz-radial-gradient(center,circle,red 0%, orange 50%);
background:radial-gradient(center,circle,red 0%, orange 50%);
-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
}
.nav_options{
font-size: 20px;
text-decoration:none;
}
Now as I said before I've never had this problem, I've tried googling it and it said it had to do with changing the parent element width and height to percentage instead of pixels but I don't think it applied to what I'm trying to get done.
You need to put 'http://' in front of your urls, so the browser knows it is an absolute URL.
e.g. href="http://www.google.com"
Without, the browser thinks the URL is relative so it's taking you to the wrong page.
It's also better backwards compatibility to put your anchor tags inside your paragraph tags.
<p class="nav_options">Home</p>
Your syntax is not correct. If you want link with text you should first try this
link text
<nav>
<table id="nav_table">
<tr>
<td class="nav_border">
Home</p>
</td>
<td class="nav_border">
<p class="nav_options">Restaurants</p>
</td>
<td class="nav_border">
<p class="nav_options">Near you</p>
</td>
<td class="nav_border">
<p class="nav_options">Order Here!</p>
</td>
</tr>
</table>
</nav>
Your cod isn`t correct , you must add < a > < / a > tag in to < p > < / p >
if you want clickable cell use it CSS for a tag :
a.Click {
width:100%;
height:100%;
display:block;
text-align:center
}

Styling table rows as headings

I'm working on a mobile site targeting older phones that have limited CSS \ html support and so I'm reverting to tables.
What I'm trying to achieve on a particular page is to have a table row with a heading of a particular value and then another row in the same table with the value and a link to edit
The problem is that the heading spans only one column and I would like to be able to style it so that there is some padding and margins as well as a border.
Can someone provide some advice on how to do this?
HTML
<div class="navalt">
<table style="width:100%;">
<tbody>
<tr class="edHeading">
<td><fmt:message key="editprofile.location"/></fmt:message></td>
</tr>
<tr>
<td class="leftTd">USA</td>
<td class="rightTd">Edit</td>
</tr>
CSS
.navalt {
text-align:center;
padding: 4px 0px 4px 4px;
border-top: thin solid #C5C9D1;
border- bottom: thin solid #C5C9D1;
}
.edHeading {
padding: 4px 0px 4px 4px;
background-color:#E9E1FF;
}
.leftTd {
border-right: thin solid #C5C9D1;
padding: 0px 0px 0px 5px;
text-align:left;
width:50%;
}
.rightTd {
padding: 0px 5px 0px 0px;
text-align:right;
width:50%;
}
As Wabs said, you could just add a colspan to your td in the heading.
Another way, which will allow you to separate your styling more, is to use the thead tag - seeing as you have used <tbody> this would make more sense.
Also - as a side note, you have no closing tags for your div and body and table - though i assume this is because you only copied part of your code..?
Here is a fiddle: http://jsfiddle.net/f6NKt/2/
the code is as:
HTML
<table style="width:100%;">
<thead>
<tr>
<th colspan="2">Heading - location use th tags</th>
</tr>
</thead>
<tbody>
<tr>
<td class="leftTd">USA</td>
<td class="rightTd">Edit</td>
</tr>
</tbody>
</table>
and CSS - notice use of thead instead
.navalt {text-align:center;padding: 4px 0px 4px 4px;border-top: thin solid #C5C9D1;border- bottom: thin solid #C5C9D1;}
thead {padding: 4px 0px 4px 4px;background-color:#E9E1FF;}
thead th {font-size:20px;}
.leftTd {border-right: thin solid #C5C9D1;padding: 0px 0px 0px 5px;text-align:left;width:50%;}
.rightTd {padding: 0px 5px 0px 0px;text-align:right;width:50%;}
Unless I'm missing something, could you not add colspan=2 to the header <td> so it spans your entire table?
<tr class="edHeading"><td colspan="2"><fmt:message key="editprofile.location"/></td></tr>

Vertically, Center-fit an image inside a Table row '<tr>'

I need to center-fit a background image in a HTML Table row <tr>, the size of the image is 40px height and 10px width. Also I need to put a border around the background image, same with border:2px solid #cccccc;
The HTML is generated from Javascript so changes must be in CSS.
Here is how it looks:
Rendered part of the page:
http://snag.gy/4EYin.jpg
Generated HTML:
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td align="left" style="vertical-align: top;">
<ul class="mystyle">
<li>
</li>
</ul>
</td>
</tr>
<tr>
<td align="left" style="vertical-align: top;">
<ul class="mystyle" style="padding-top: 0px; padding-bottom: 0px;">
<li>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
CSS:
.mystyle {
border:2px solid #cccccc;
background: url(../images/bar.png) no-repeat center left;
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffe732', endColorstr='#ffffff',GradientType=1 ); /* IE6-8 */
width: 247px;
}
Update:
The current image is almost good only that it have some unwanted "spaces" top and bottom.
<style>
.mystyle {
border:2px solid #cccccc;
background: url(bar.png) no-repeat center left;
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffe732', endColorstr='#ffffff',GradientType=1 ); /* IE6-8 */
width: 247px;
background-position:center;
}
</style>

3d borders on a html row

My pen: http://codepen.io/helloworld/pen/gimoI
I want to have a gray and white border on a table row to achieve a 3d effect.
Why is only one border color visible?
<link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<table style="width:100%;">
<tr>
<td style="vertical-align:top;width:60px;">Alarm 1</td>
<td style="width:auto;">
<span style="font-weight:bold;">Brand LANG: </span>
<span>Helmenstraße 5</span>
<span>90000 Nürnbergxxxxxxxxx</span>
</td>
<td style="width:30px;text-align:center;"> <i class="icon-angle-down button"></i></td>
</tr>
<tr>
<td style="width:60px;vertical-align:top;">
<div style="border-radius:28px;border:black solid 1px;background:red;">Alarm 1</div>
</td>
<td style="width:auto;">
<span style="font-weight:bold;">Brand LANG: </span>
<span>Langenburgerwald allee 25/c</span>
<span>70000 Wurmlingen ob der Tauber</span>
</td>
<td style="width:30px;text-align:center;"> <i class="icon-angle-down button"></i></td>
</tr>
</table>
body,html{
padding:0;
margin:10px;
background:#fafafa;
}
table{
border-collapse:collapse;
border-spacing:0;
}
table td
{
padding: 5px;
}
td {
border-bottom: gray solid 2px;
border-top: white solid 2px;
background:green;
}
Because the top border is white and is difficult to see the diference with the background.
I just updated it now:
body,html{
padding:0;
margin:10px;
background:#fcc;
}
table{
border-spacing:0px;
}
table td
{
padding: 5px;
border-bottom: gray solid 2px;
border-top: white solid 2px;
}
tr {
background:green;
}
You have to remove border-collapse:collapse;
Check this [http://codepen.io/anon/pen/vIHcf][1]
You need to work with box shadows . I just also described it in my one of the answer of same type of questio Link to that Answer or you can go through to this link to learn more about box-shadowsStudy box shadow
you can add
-webkit-box-shadow:10px 10px 5px #595959; -moz-box-shadow:10px 10px 5px #595959; -o-box-shadow:10px 10px 5px #595959;
in your td style & then find that is it same as you want ..
Both are visible on my side.
Little alternative or addition to achive 3d effects:
You can use CSS Outline. Its like a second border.
http://www.w3schools.com/css/css_outline.asp
I see the blank and grey border. But if you want to put some 3d effect on the rows why don't use box-shadow?
box-shadow: inset 1px 1px 3px #000;
Here I made an example with your code.

HTML Table width .

It seems to me that I horribly missing something here but I can't get the cell
of the following table to span across the whole table with. See following jsfiddle link attached:
http://jsfiddle.net/jeremysolarz/5stQc/2/
I know table design isn't nice but I'm working with a legacy application here with a lot of
gif spacer images and I want to remove this and switch to a more CSS centered layout.
Please help.
Is it necessary to have a nested table in this case? If you just had a single table and used <th colspan="3"> would this solve the issue? Sorry if this is not the case but it seems like you are overcomplicating it!
You are currently declaring the width of the table inline(in the html) and in the CSS and both values are different, you should wrap the tables in a div as follows, and remove the inline width declaration.
/* frames */
#foo{
width:100%;
display: inline-block;
}
.newframeContainer {
padding:0;
margin:0 auto;
text-align: left;
width:70%;
height: auto;
border:none;
-moz-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
border: 1px solid #B6B6B6;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
The Html should now look like this:
<div id="foo">
<table height="100%" class="newframeContainer" cellspacing="1">
<tbody>
<tr height="27">
<th colspan="3">
ADAM Statistics
</th>
</tr>
<tr height="99%">
<td class="text-bold">Total Project Budgets [USD] </td>
<td>test</td>
<td valign="top" align="right">
192,609,012
</td>
</tr>
<tbody>
</table>
</div>