Jump to content

Can I change the color of a table border?


LaLaLa

Recommended Posts

First, I'm NOT using styles, just plain old HTML. I have a table and am trying to change the type+color of the border. It's normally just that creme colored 3D type look, but I want to have just a solid black border. The background of the table is a green color. I know it is possible in styles, but right now I not using those, so if anyone knows, please tell me! The entire code is below:

[left]<html><head><title>My webpage</title></head><body><center><br><br><table border="1" width="800" height=500" bgcolor="rgb(0,155,0)"><tr><td align="center">Testing this!</td></tr></table></body></html>

[/left]

Link to comment
Share on other sites

  • Replies 78
  • Created
  • Last Reply

Top Posters In This Topic

Why do you want to even use deprecated attributes? Why don't you want styles, where styles have much more convenience and so on?You can use this attribute for the table element: bordercolor="black", but a stylesheet or even a style attribute can be much better in all cases. Why won't you use that? :)*gives the deprecated style with resistance* You should use styles anyway, actually, everyone does, I don't understand :)

Link to comment
Share on other sites

Why do you want to even use deprecated attributes? Why don't you want styles, where styles have much more convenience and so on?You can use this attribute for the table element: bordercolor="black", but a stylesheet or even a style attribute can be much better in all cases. Why won't you use that? :)
Thanks for telling me : ) I'm working on learning styles, but they're too confusing! Thanks again!
Link to comment
Share on other sites

Everything is scary in the beginning, don't let it scare you! If you must, you can do anything. Just have faith. :)Styles are good, though sometimes confusing, but if you practice, you will learn them definately! :)
Now I got the bodercolor tag to work : ), but now I'm wondering how to change the border's style and make it just a pure, single-lined border. Right now it has a double-line border. How can I change this?I've tried:
  • <table borderstyle="solid">
  • <table style="solid">
  • <table bordertype="solid">
  • <table type="solid">

Link to comment
Share on other sites

You can find all in the CSS tutorial. But in short, this is the full border style:

<table ... style="border:solid 1px black">

http://www.w3schools.com/css/css_reference.asp#borderAnd this can be changed to whatever type you want, like solid, dotted, dashed, double, inset, outset,.. :)Also the width of the border may be everything you want. You're even not sticked to pixels, but I recommend though. The color you define like this represents all four sides, and you are again allowed to either use a hexvalue (eg #000000), an RGB value (eg rgb(0,0,0)), or a colorname (eg black). Hexvalues are recommended.And to go one step beyond this, all this style can be set in a central stylesheet, so if you have several of the same tables that should also get the same style, you would only need to alter the central style, and all tables with that class will get the changes. Stylesheets are strongly recommended by W3C, that is part of why XHTML was made.

Link to comment
Share on other sites

You can find all in the CSS tutorial. But in short, this is the full border style:
<html><head><title>My webpage</title></head><body background="http://www.freewebs.com/naturalimpressionsart/J0143753.GIF"><center><br><br><table cellspacing="0" border="1" bordercolor="black" width="500" height="800"bgcolor="rgb(178,178,153)"><tr><td align="center">Testing this!</td></tr></table><br><br></body></html>

Link to comment
Share on other sites

How do I change the border color of an image? I tried <bordercolor="somecolor"> and it still won't work...

Link to comment
Share on other sites

An image has for default no border. Only when it gets embedded in an anchor (<a>), then it gets a border. It can be shut down by the border="0" attribute for the image, but you can't controll the colour without styles. There is no such thing as bordercolor for either an anchor or an image. :)You should use this then:

<a ... style="border:solid 2px purple">...</a>
Where the coloured code should be replaced with the colour you want of cource. It can be again a hexvalue, an rgbvalue or just a colourname.
Link to comment
Share on other sites

An image has for default no border. Only when it gets embedded in an anchor (<a>), then it gets a border. It can be shut down by the border="0" attribute for the image, but you can't controll the colour without styles. There is no such thing as bordercolor for either an anchor or an image. :)You should use this then:Where the coloured code should be replaced with the colour you want of cource. It can be again a hexvalue, an rgbvalue or just a colourname.
DARN! I wish I could change that in HTML...Thanks anyways for the advice. I added border="5" to the image tag so it looked like this:
<img src="file:///C:/My_Picture.jpg" align="top" border="5" bordercolor="blue">

I know that you can change the color of linked image borders with the "link, alink, and vlink" tags, but I just wanted to change the color of an unlinked border!EDIT: That's OK now, I just stuck the border in with the image file, so now it's exactly the same thickness and clor that I wanted it to be : D...I'll probably have another dumb question later... oh, so then, when you try to "center" text that you're getting ready to post on here, then you click the "Preview Post" button, when you look at your post code, the end of the "center" alignment changes to something different! Look:

[center]Blah..Blah...Blah... My post is here![/center]

Turns into:

[center]Blah..Blah...Blah... My post is here!</div>

Then if you submit your post after it has been changed, the centering won't work! Maybe its just me...?

Edited by LaLaLa
Link to comment
Share on other sites

Don't worry for html styles, if you practice enough, you can easily study CSS at a later moment :) If you only want to, it is so much better than presentation markup.
Now I have another question:On my website I would like to have a simple little form. There would be a just text box for someone to type there e-mail and a submit button that would transfer their message to my e-mail address. I know that there is a "Mailto" thing, but that opens up Outlook Express and makes you type it in there and personally I think its a pain. Is there a way to modify the "Mailto" command? Can you do it any other way? Thanks!P.S. Does anyone have a clue what Runescape is? Rune H.Q.?
Link to comment
Share on other sites

Right for this, you just need a simple form, so here I have the code ready made, arent I good :) :

<FORM METHOD=POST ACTION="mailto:[color="#000099"]youremail[/color]?subject=[color="#000099"]your sublect[/color]" ENCTYPE="text/plain"><table border="0" width="100%"><tr><td height="40"><font size="2">Email Address</td></tr><tr><td height="40"><INPUT TYPE="text" NAME="Guests Email" SIZE="30"></td></tr><tr><td height="40"><font size="2">Post:</td></tr><tr><td><script type="text/javascript"><!--var pcount = 0;var ncount = 0;// --></script><TEXTAREA NAME="Guests Post" ROWS="10" COLS="120" style="font-family: arial;" [color="#FF0000"]onfocus="if (this.value==[b]'Add Your Message Here[/b]') {this.value='';}" onblur="if (this.value=='') {this.value=[b]'Add Your Message Here[/b]';}">[b]Add Your Message Here[/b][/color]</TEXTAREA></td></tr><tr><td height="40"><center><INPUT TYPE="submit" VALUE="Submit Post" [color="#009900"]onclick="window.location='thankyou.html';"[/color]>   <INPUT TYPE="reset" VALUE="Clear Post"></center></td></tr></table></form>

Now here you have a basic form, where users can submit their email and post. Change the blue bits to your email and the subject that ou would like the post to be sent as.Change the bold bits to whatever you want to display in the box, until the user clicks their, then it will disapear, if they click of it will return. If you din't want this at all delete the red code completely.You may notice in the submit button their is the code onclick="window.location='thankyou.html';", just replace the thankyou.html with any file that you would like to open when the user clicks submit, or if you dont want it, delete the green code.Then also there is a reset button, which will clear the post if clicked.Now there are problems with this type of form submission, and so I think you may like to read post #1&2 in this topic here.You may also wonder why I have not put the code in the

Blah Blah Blah

tag, this is because you cannot format text in them and it is easier to understand when you can.Edit: Why do you want to know the users email, when it tells you their email, because it sends it from their email?

Link to comment
Share on other sites

That doesn help anything, Holmedwa04. I think LaLaLa wants to bypass the mail program at submit. That is indeed possible, but not by client-side. You would need a server-side language like PHP to execute the very command to mail anything.

<?phpmail ($to,$subject,$message,$headers);?>

This uses the mail service at the server, eg an SMTP (I think). It is able to actually send the mail, opening a program to do that on the client side would not be necessary.But then again, you will need to use eg PHP to process the data of the form. That processor (that can be the same file this form is in) wouild be defined at the action attribute of the <form> element. Do you understand this? When you do want to bypass the program like Outlook Express or Hotmail or Gmail if you use either of those, you need server-side scripts to deal with the actual sending of the mail. This topic should then be moved to PHP forum :)[*Edit:]@holmedwa04: but you can format text in a code box. Well, not really, but you should use a QUOTE box for that. :) Besides, your code it actually besides the point, it does only use the mailto protocol, and the question was how to modify it (not possible but use alternate, a processor)

Link to comment
Share on other sites

I understand, it is just that I myself, cant use any server scripts or programs, unless I pay more for another package. And that is why I do it the way I do. Unless there is another way, where the sever would send the post to me without using the users email?

Link to comment
Share on other sites

Right for this, you just need a simple form, so here I have the code ready made, arent I good :) :
<FORM METHOD=POST ACTION="mailto:[color="#000099"]youremail[/color]?subject=[color="#000099"]your sublect[/color]" ENCTYPE="text/plain"><table border="0" width="100%"><tr><td height="40"><font size="2">Email Address</td></tr><tr><td height="40"><INPUT TYPE="text" NAME="Guests Email" SIZE="30"></td></tr><tr><td height="40"><font size="2">Post:</td></tr><tr><td><script type="text/javascript"><!--var pcount = 0;var ncount = 0;// --></script><TEXTAREA NAME="Guests Post" ROWS="10" COLS="120" style="font-family: arial;" [color="#FF0000onfocusif thisvalueb#39Add Your Message Hereb#39 thisvalue#39#39 onblurif thisvalue#39#39thisvalueb#39Add Your Message Hereb#39gtbAdd Your Message Herebcolor"]</TEXTAREA></td></tr><tr><td height="40"><center><INPUT TYPE="submit" VALUE="Submit Post" [color="#009900"]onclick="window.location='thankyou.html';"[/color]>   <INPUT TYPE="reset" VALUE="Clear Post"></center></td></tr></table></form>

Now here you have a basic form, where users can submit their email and post. Change the blue bits to your email and the subject that ou would like the post to be sent as.Change the bold bits to whatever you want to display in the box, until the user clicks their, then it will disapear, if they click of it will return. If you din't want this at all delete the red code completely.You may notice in the submit button their is the code onclick="window.location='thankyou.html';", just replace the thankyou.html with any file that you would like to open when the user clicks submit, or if you dont want it, delete the green code.Then also there is a reset button, which will clear the post if clicked.Now there are problems with this type of form submission, and so I think you may like to read post #1&2 in this topic here.You may also wonder why I have not put the code in the

Blah Blah Blah

tag, this is because you cannot format text in them and it is easier to understand when you can.

Thankyou so much!!! It works perfectly!

:)One question, though, is there a way that i can get the post area to automatically adjust to 100% of the browser width?

Link to comment
Share on other sites

Yes, as I explained. If you use server languages like PHP, you can let the server send the mail for you. Then there is no need of the mailto protocol, nor a program like outlook express :)But was this subject addition all you needed, LaLaLa?

Link to comment
Share on other sites

Im very confused now?!?!? :)

Thankyou so much!!! It works perfectly!

:)One question, though, is there a way that i can get the post area to automatically adjust to 100% of the browser width?

You could try changing the cols="120" in the textarea tag, to 100%, but I am not sure, try it and see, you see, you usually specify it in column, i.e. letters wide.
Link to comment
Share on other sites

Im very confused now?!?!? :)You could try changing the cols="120" in the textarea tag, to 100%, but I am not sure, try it and see, you see, you usually specify it in column, i.e. letters wide.
By it working right, I just meant the layout, I haven't actually triend sending it yet... :)I did try changing the COLS="120" area to 100%, but it read it as 100 characters wide, not 100%Also, right now I just tried sending it and when I clicked on "Submit", an alert box poped up that said:"This form is beging submitted using e-mail.Submitting this form will reveal your e-mail address to the recipient, and will send the data without encrypting it for privacy.You may continue or cancel this submission."What's this all about? Then, when I clicked OK, an error box came up that said:"Personal Folders:This information service has not been configured. Select an existing file to configure, or type the name of a new file to create."????? Edited by LaLaLa
Link to comment
Share on other sites

This form, to let visitors send messages to the owner of the site, uses mailto: at its action. That means, the mail setup program (the one with which you actually send the message) like Outlook Express, will get called.Replacing that mailto: by a PHP processor file like this: send_mail.php means the processor will send the mail instead of Outlook. And besides that, it WILL work in all browsers, as the mailto command doesn't. With php, you can specify the to address, the from, reply to, cc and bcc, subject and message. With the mailto command, you can't. You can try, but only Hotmail (as far as I know) recognises those. Like you specified the subject in the form you posted :) Gmail doesn't use that addition to the mailto command. But PHP can do it all by itself, I can give you a processor file that has the form in itself, here it is, for example :)

<?php//Your email address:$your_Email = "owner@thissite.com";//quite editingIf($_POST["message"] != ""){ $result = mail($your_Email,$_POST["subject"],$_POST["message"]); echo "Thanks! Your mail has been send!";}else{?><html><head><title>Mail form</title></head><body><form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p> Subject:<br> <input type="text" name="subject" size="43" /></p> <p>Message:<br> <textarea rows="9" name="message" cols="36"></textarea></p> <input type="submit" value="Send" name="actie" /><input type="reset" name="Reset" value="Reset" /></form></body></html><?php } ?>
Link to comment
Share on other sites

You only need to upload this, ONLY when you are sure your host supports PHP files. Then only edit the email at the top of this file, and don't do anything else. It will work onitself, there is no need of any form, this file has one itself.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...