XHTML

Some of us love those electrons just a little too much
Post Reply
Klast Brell
Sublime Prince of teh Royal Sekrut Strat
Posts: 4315
Joined: Fri Dec 20, 2002 11:17 am
Location: Minneapolis MN

XHTML

Post by Klast Brell »

Any of you good with web design?

I'm taking an XHTML class right now and I'm hitting a wall on how to do part of an assignment. We have to recreate this table.
Image
I have it almost done, but I'm hitting a wall when it comes to coloring in the lines. The border color stuff that I know how to do will do the outside border of the table, but the inside lines are not getting the color applied to them. I end up with this.
Image
I suppose I could set another font color in the style, and use a span tag in each of the 9 cells, but it just seems like way to much duplication of effort. Is there another way?

Here is my code so far:

Code: Select all

<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<title>Tables</title>
<style type="text/css">
table {
  color: red;
  background-color: white;
font-weight:bold; text-align:center; font-family: sans-serif;}
.changeTypeface
{background-color: white; color: black; font-weight:normal}
</style>
</head>
<body>
<table cellspacing="0" bordercolor="#808000" border="1" width="575">

<tr>
<td width="115" rowspan="4">1
<br />
<span class="changeTypeface">The quick<br />

brown fox<br />
jumped... <i>ahh<br />
who cares</i></span>
</td>
<td colspan="3">2</td>
<td rowspan="2">3</td>
</tr>

<tr>
<td rowspan="2">4</td>

<td colspan="2">5</td>
</tr>

<tr>
<td>6</td>
<td>7</td>
<td rowspan="2">8</td>
</tr>

<tr>
<td colspan="3">9</td>
</tr>

</table>
</body>
</html>
I used color in the table style to set the color of the 9 numbers. It applied it to the grid lines as well.
I'm sure the answer goes in here somewhere

Code: Select all

table {
  color: red;
  background-color: white;
font-weight:bold; text-align:center; font-family: sans-serif;}
I could change color; red; to color; yellow; but then the numbers would be all yellow as well. Is there a way to set the font color separate from the grid line color?
"A few months ago, I told the American people I did not trade arms for hostages. My heart and best intentions still tell me that's true, but the facts and evidence tell me it is not." - Ronald Reagan 1987
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: XHTML

Post by Taxious »

You have to set the CSS to apply to the inside of the table borders as well as the main table border. Try something like this:

Code: Select all

<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<title>Tables</title>
<style type="text/css">
table { color:red; background-color: white; font-weight:bold; text-align:center; font-family: sans-serif; border: 1px solid #808000;}
table tr, table td {border: 1px solid #808000;}
.changeTypeface {background-color: white; color: black; font-weight:normal}
</style>
</head>
<body>
<table cellspacing="0" width="575">

<tr>
<td width="115" rowspan="4">1
<br />
<span class="changeTypeface">The quick<br />

brown fox<br />
jumped... <i>ahh<br />
who cares</i></span>
</td>
<td colspan="3">2</td>
<td rowspan="2">3</td>
</tr>

<tr>
<td rowspan="2">4</td>

<td colspan="2">5</td>
</tr>

<tr>
<td>6</td>
<td>7</td>
<td rowspan="2">8</td>
</tr>

<tr>
<td colspan="3">9</td>
</tr>

</table>
</body>
</html>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Klast Brell
Sublime Prince of teh Royal Sekrut Strat
Posts: 4315
Joined: Fri Dec 20, 2002 11:17 am
Location: Minneapolis MN

Re: XHTML

Post by Klast Brell »

BTW: I figured out the CSS in my code on my own. That's why it's so half assed. they haven't really covered styles in the class and the textbook is horseshit. It was created by some other teacher and put online. Here is an example of the section teaching us how to do tables.
http://htmltutorialonline.info/XH1301Notes07.html Half the students are teaching themselves from other books they bought at Barnes and Noble. The other half are just completely lost and have no idea what's going on.

The teacher for my class is pathetic. She is the teacher for the Excel and Access classes, and told us she was asked to teach the XHTML class 2 weeks before the semester started. I can tell she is winging it. She probably took an HTML class 10 years ago and thought she could refresh her knowledge and learn the new stuff from the class website. She failed. She cant figure out a lot of the stuff she is trying to teach us. 4 times already I figured out on my own how to do something she was struggling with. When I raised my hand to explain how to do it, she asked me to come up to the teacher computer and show the class how to do it. 4 fucking times already I have taught the class. I'm teaching myself most of this stuff and I'm even teaching the other students. I shouldn't be paying for this class. They should be paying me.
"A few months ago, I told the American people I did not trade arms for hostages. My heart and best intentions still tell me that's true, but the facts and evidence tell me it is not." - Ronald Reagan 1987
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: XHTML

Post by Taxious »

That sounds horrible Klast. :?

Generally, I <3 the w3schools website for all of my CSS needs. Here is a good listing of all the border declarations and properties available: http://www.w3schools.com/css/css_border.asp

The "color" attribute is generally used for font coloring, where the "border" attribute is good for controlling everything (including the color) of the border.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Klast Brell
Sublime Prince of teh Royal Sekrut Strat
Posts: 4315
Joined: Fri Dec 20, 2002 11:17 am
Location: Minneapolis MN

Re: XHTML

Post by Klast Brell »

Thank you Tax. You rock!
"A few months ago, I told the American people I did not trade arms for hostages. My heart and best intentions still tell me that's true, but the facts and evidence tell me it is not." - Ronald Reagan 1987
Klast Brell
Sublime Prince of teh Royal Sekrut Strat
Posts: 4315
Joined: Fri Dec 20, 2002 11:17 am
Location: Minneapolis MN

Re: XHTML

Post by Klast Brell »

I'll probably have more questions like this as time goes on. Hopefully not too many so I don't drive you nuts.

Now that I know what CSS properties you used I'll have to go back to my reference materials and learn the different ways to use them. That's part of the problem with this class. They don't teach you enough to know what key words to use when you are searching for the answers. I had no idea that the inside lines were called table tr, table td in CSS. Now that I do I can look up different ways to manipulate them if I need to.

Again. Thank you.
"A few months ago, I told the American people I did not trade arms for hostages. My heart and best intentions still tell me that's true, but the facts and evidence tell me it is not." - Ronald Reagan 1987
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: XHTML

Post by Taxious »

Klast Brell wrote:I had no idea that the inside lines were called table tr, table td in CSS. Now that I do I can look up different ways to manipulate them if I need to.
It's not so much that the inside lines are called "table tr, table td" but more that a "table" has some "tr" (table rows) and some "td" (table cells). You could say that they are children of the table. In fact, you don't even need the "table" declaration in front of them, but some people consider it good practice. This works too:

Code: Select all

tr, td {border: 1px solid #808000;}
The comma in that css declaration just means that you are giving the same properties to two elements at once.
For example:

Code: Select all

table tr, table td {border: 1px solid #808000;}
is the same as:

Code: Select all

table tr {border: 1px solid #808000;}
table td {border: 1px solid #808000;}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: XHTML

Post by Taxious »

And no worries about asking for help. It's pretty dorky, but web programming stuff is one of my "life passions" so I love helping other people out and feeling useful in the area. :lol:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Freecare Spiritwise
Grand Pontificator
Posts: 3015
Joined: Thu Mar 13, 2003 5:35 pm

Re: XHTML

Post by Freecare Spiritwise »

Off topic, but:

At best I fumble through CSS. I did a whole insurance quoting system without a single line of HTML - no style sheets - all code. All dynamically generated with code, and left up the .NET framework for how best to generate the HTML. I can even flip a switch and target different browers. All the style settings are in the database, and I can run an SQL script and get a totally different look. No style sheets, just style data rendered with object-oriented code.

But alas, nobody could wrap their brains around the fact that the whole application had one web page, and the only thing on it was a placeholder control. If you expect to be able to hire people to work on and actually understand your web applications, you end with up something like our new claim system which is up to a about about 1,000 .ASPX web pages with a slew of style sheets. I found a style sheet I really liked from one of the MSDN sample projects and just stole it and modified it a little. Not a bad way to learn CSS either - find slick looking web sites and dissect their style sheets.

Most massive web sites like msn.com use a hybrid of what I was doing - dynamically generated HTML that references static style sheets.

Here's a shot of the "HTML-less" application. It has all the goodies like roll-up panels and pop-down calendar controls:
iq.jpg
And our new claim system done with bazillions of HTML web pages and style sheets, and a sprinkling of AJAX. Same client side interactive widgets:
claims.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: XHTML

Post by Taxious »

I really like the template system that Drupal (php) has set up, but it's probably only because I've worked with it the most.

We have an asp.net framework that we sell to clients at work which I'm becoming more fond of as time goes by. It's pretty shaky compared to stuff like DNN, but it gets the job done. The site I'm working on now only has about 20-30 .aspx template pages, but like you said, it's easier to see it all laid out that way compared to just one.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Freecare Spiritwise
Grand Pontificator
Posts: 3015
Joined: Thu Mar 13, 2003 5:35 pm

Re: XHTML

Post by Freecare Spiritwise »

Taxious wrote:It's pretty dorky, but web programming stuff is one of my "life passions" so I love helping other people out and feeling useful in the area. :lol:
It's my passion too, but I focus more on the nuts and bolts. To me, creating an HTML web page is about the same pinnacle of acheivement as creating a Word document. I like to focus on all the unglamarous stuff like system configuration, logging, security, integration, document management, database access and so forth.

And I'm always available to help as well on any nitty gritty code issues. Right now I'm writing a reporting engine that generates PDF reports on the fly using .NET code.

And shit Tax, we should be farming you out for our style sheets. I've got a good eye for layouts, and I've won a few awards for user interface design over the years, but I'd rather claw my eyes out than write CSS code, and I always get left holding the short straw.
Freecare Spiritwise
Grand Pontificator
Posts: 3015
Joined: Thu Mar 13, 2003 5:35 pm

Re: XHTML

Post by Freecare Spiritwise »

The thing about doing everything dynamically is that not only could I change the style with one line of code (which you can also do with style sheets), I can change every aspect of the application in one shot.

For example, I was using these pop down calendar controls and one client loved them and one client hated them and wanted text boxes. With the dynamic system I just flip a switch and client A gets calendars and client B gets text boxes. I change it in one place and all 1,000 "virtual" web pages show the new controls.

With the new system we'd have to change every control on every .aspx page by hand, and probably branch the entire project which is a maintenance nightmare. Honestly, if client B doesn't like the calendar controls with the new system, we'll probably have to tell them 'sorry, live with it'.
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: XHTML

Post by Taxious »

Freecare Spiritwise wrote:And shit Tax, we should be farming you out for our style sheets. I've got a good eye for layouts, and I've won a few awards for user interface design over the years, but I'd rather claw my eyes out than write CSS code, and I always get left holding the short straw.
I actually suck ass (lulz) at the whole design/artsy part of it. I really get into the back end (lulz) junk, but I've had enough problems with CSS (and asking our design team for help) that I know a thing a two about it.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Talaena
Prince of Jerusalem, Ohio
Posts: 627
Joined: Fri Dec 20, 2002 1:06 pm

Re: XHTML

Post by Talaena »

This might prove to be an interesting thread. My boss has asked me to convert, for starters, our point of sale screen that was written for old HP CRTs (700/92s) and is completely keyboard based. I am writing it using PHP because I sort ofknow the language and the app has to run on both HP/UX and Linux.

I am not even to the design/CSS/artsie side of the program. I'm horrible at design. I have no CSS experience, I stopped writing HTML before CSS was around. I have a plane white on black <TABLE> based program right now, with lots and lots and lots of PHP functions to generate all the necessary HTML.

this entire process is fun, but at the same time close to overwhelming. :P
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: XHTML

Post by Taxious »

Talaena wrote:I have a plane white on black <TABLE> based program right now, with lots and lots and lots of PHP functions to generate all the necessary HTML.

this entire process is fun, but at the same time close to overwhelming. :P
Mmmmm I love php. I know there was another thread where Dd and Free were ripping on it though. I cried.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Klast Brell
Sublime Prince of teh Royal Sekrut Strat
Posts: 4315
Joined: Fri Dec 20, 2002 11:17 am
Location: Minneapolis MN

Re: XHTML

Post by Klast Brell »

It's a night class and we have lecture only once every other week. The way it's being taught i only do things one time when I do the homework. So I end up figuring out how to do it that one time, in that specific way and then I never touch it again. I downloaded 4 different books, plus I have bookmarks for a bunch of websites, but in every case they only tell you how to do it one time and then move on to the next thing. I need practice. I want to learn one concept and then use it a bunch of times in different ways till i fully understand on a deep level how it works and how it interacts with other things.

In grade school math I would be taught one concept, and then be sent home with a worksheet of 20 problems using that concept. We would be taught how to factor a polynomial, then be given 20 polynomials to factor. I want something like that for XHTML. Are there any websites you have heard of that have those kinds of exercises?
"A few months ago, I told the American people I did not trade arms for hostages. My heart and best intentions still tell me that's true, but the facts and evidence tell me it is not." - Ronald Reagan 1987
Freecare Spiritwise
Grand Pontificator
Posts: 3015
Joined: Thu Mar 13, 2003 5:35 pm

Re: XHTML

Post by Freecare Spiritwise »

PHP is a good framework, but it's a lightweight framework. It's much better suited to running a discussion forum like this one than for industrial strength business applications. It's nowhere near as powerful as something like the .NET framework. You can almost solve that by coupling it with Java (OOP FTW!) but it's going to be clunky no matter what you do, and for most of what I do, it would be like pounding a square peg in a round hole.

I'd make the same gripes with classic ASP and maybe even early ASP .NET, but starting with framework 2.0 it just got badass with things like the generic provider model.

With the HTTP pipeline model I have control over my web application pretty much down to the sockets level. I can do things with one line of .NET code that would take a week to do with PHP.

For something like my sister's credit repair web site it'd probably be fine, but I had her install Visual Studio 2008 and she was hooked. There's no other development tool that I've seen that's even in the same league as VS. I've been with Microsoft since day one of Windows, and that's one of the key secrets to their success - spoil the developers...

Everything I could ever want is built into the framework, and if for some reason it isn't, then they made it easy to work around. For example, they have a generic user membership providers built in. Everything to handle page security, users, roles, etc. is all right there. But our system needs to look at multiple systems for a user login. If a user isn't in system A, I try to find the user in system B, and so on, which the stock provider doesn't do. So I wrote custom membership and role providers and it fits in to the existing framework seamlessly. The built in page web page security treats my custom provider no differently than its own provider.

And their provider model is all-encompassing. There's generic database providers, generic encryption providers, you name it. I can re-invent part of the wheel without re-inventing the whole wheel - it's badass. It used to be if you didn't want do something the "official MS way" then you had to bypass all of it - it was all or nothing. Now I can deviate from it just a little bit and it's still "by the book".
Talaena
Prince of Jerusalem, Ohio
Posts: 627
Joined: Fri Dec 20, 2002 1:06 pm

Re: XHTML

Post by Talaena »

I'm also learning I am not good at structuring code. What I've been working with for 8 years looks like:

Code: Select all

2770 Invfound:IF S(1) THEN Dberr
2780          DBGET (B$,"INVOICE",5,S(*),"@;",Buf$,"")
2790          IF S(1)=15 THEN 2710
2800          IF S(1) THEN Dberr
2810          DBGET (B$,"OE-CONTROL",7,S(*),"@;",Buf$,Admin_proj$)
2820          IF S(1)=17 THEN 2850
2830          IF S(1) THEN Dberr
2840          GOTO 2870
2850          DBGET (B$,"OE-CONTROL",7,S(*),"@;",Buf$,"ALL ")
2860          IF S(1) THEN Dberr
2870          DBGET (B$,"CUSTOMER",7,S(*),"@;",Buf$,Cust_num)
2880          IF S(1) THEN Dberr
2890          Flag=2
2900          CURSOR OF#1
2910          DISP USING "6D,/,6D,/,2Z,/,2Z,/,2Z";Inv_num,Cust_num,FNMonth(Inv_d
ate),FNDay(Inv_date),FNYear(Inv_date)
2920          DISP Bill_name$,Bill_add1$,Bill_add2$,Bill_city$,Bill_state$,Bill_
zip$[1,9],Ship_name$,Ship_add1$,Ship_add2$,Ship_city$,Ship_state$,Ship_zip$[1,9]
2930          CURSOR OF#19
2940          DISP Inv_ref$
No real structure. My boss wrote a massive accounting program in HP Eloquence. It's all based on line numbers, goto statements, database calls (DBGET, DBFIND, being sorta akin to SQL SELECT statements). Most of what I have done for 8 years is append his code; generally using the existing structure.

That type of thought doesn't fly with the PHP. My first pass at this program, it was all interspersed:

<html>
<? php stuff?>
more plain html
<? lots more php stuff?>
</html>

Essentially mirroring how our ELoquence programs are written. No real function calls, just code dumped together. I had the screen working 50-60%, then made a backup and started to clean up the code. Dropping re-usable code into functions, putting those functions into .inc files to separate them from the main HTML.

The function has stayed the same, but the code is broken out into multiple .inc files with related functions inside of each. But overall the code looks sloppy and I really don't know where to go.

I know nothing about Object Oriented programming. A friend in IRC has suggested making, say, a database object so that if I ever change databases from eloquence to MySQL or Oracle, etc., the only code that has to change is inside the Db object. All the other PHP files just do DB->open() or however objects work. :P

At least I'm trying sometihng new instead of working with 25 year old Eloquence code.

I have abandonded buying books for google and bookmarks. I have a ton of CSS/XHTML sites bookmarked and waiting for when I move onto design. php.net has been a great resource for all the dumbass questions I have. My boss bought my an O'Reilly book that i never use. I enjoy the O'reilly books, but google is better. :)
User avatar
Taxious
Rum Guzzler
Posts: 5056
Joined: Fri Apr 18, 2003 10:16 am
Location: Denver, CO

Re: XHTML

Post by Taxious »

Talaena wrote:I enjoy the O'reilly books, but google is better. :)
Amen. I haven't purchased a text book for my classes in over 3 years now, no problems! :D
Freecare Spiritwise wrote:PHP is a good framework, but it's a lightweight framework. It's much better suited to running a discussion forum like this one than for industrial strength business applications. It's nowhere near as powerful as something like the .NET framework. You can almost solve that by coupling it with Java (OOP FTW!) but it's going to be clunky no matter what you do, and for most of what I do, it would be like pounding a square peg in a round hole.
Keep in mind PHP is free vs .NET that isn't. I've seen some amazing (and large) applications done in PHP that work fast and flawlessly. You know there are classes/objects in PHP too, right?
Freecare Spiritwise wrote:I can do things with one line of .NET code that would take a week to do with PHP.
orly? Are you talking about plain php here, or using a management system like Drupal/Wordpress/Moodle
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Freecare Spiritwise
Grand Pontificator
Posts: 3015
Joined: Thu Mar 13, 2003 5:35 pm

Re: XHTML

Post by Freecare Spiritwise »

Yeah, that's pretty much circa 1970's structured programming mixed with a more modern bad habbit of tightly coupling your presentation with business logic. For a small system, yeah ok, maybe. For a big system it's a recipe for disaster. I've seen companies go out of business trying to maintain systems like you described. And the companies that don't go out of business have to devote scores of developers to maintain the project.

What ends up happening is you have 1,000's of web pages all with some function called WriteToDatabase() that's copied and pasted for each page. Then you find a bug in it and you have to change it in 1,000 places, but nobody's that disciplined, so you there's a dozen you miss. Then you find another bug in the same function, and so on, then you end up with thousands of what are supposed to be the same function, except now you have several different flavors. And with thousands of web pages each containing hundreds of what are essentially the same functions, you end up with literally millions of points of failure, and the system isn't maintainable at that point.

OOP has been around several decades and it still scares people. It's not intuitive and about half the people who try to master it give up in frustration. But once it clicks, it's almost a religious experience. Encapsulation, inheritance and polymorphism. Know them, live them, love them.
Post Reply