You are viewing our Forum Archives. To view or take place in current topics click here.
Noob HTML Question
Posted:

Noob HTML QuestionPosted:

DFC
  • Wise One
Status: Offline
Joined: Jun 06, 201112Year Member
Posts: 587
Reputation Power: 24
Status: Offline
Joined: Jun 06, 201112Year Member
Posts: 587
Reputation Power: 24
I am trying to change the color of the text within the table.

In this example I am trying to change "Phone Login:" to white.

echo "<tr><td align=\"left\" colspan=\"2\"><font size=\"1\" > &nbsp; </font></td></tr>\n";
    echo "<tr><td align=\"right\">"._QXZ("Phone Login:")." </td>";
    echo "<td align=\"left\"><input type=\"text\" name=\"phone_login\" size=\"10\" maxlength=\"20\" value=\"$phone_login\" /></td></tr>\n";



I can't seem to get it working. Any help would be appreciated.
#2. Posted:
HCIM
  • Wise One
Status: Offline
Joined: Oct 17, 201211Year Member
Posts: 594
Reputation Power: 23
Status: Offline
Joined: Oct 17, 201211Year Member
Posts: 594
Reputation Power: 23
Try implementing this code.
Without just copying and pasting I will detail on how I got the result.
Using the method "span" allows to create a custom variant of what you want created.
Then I styled the "span" method which is wrapped around the text "Phone Login" and gave span a style of the color white (#fff).

echo "<tr><td align=\"left\" colspan=\"2\"><font size=\"1\" > &nbsp; </font></td></tr>\n";
     echo "<tr><td align=\"right\">"._QXZ("<span style=\"color: #fff\">Phone Login</span>:")." </td>";
     echo "<td align=\"left\"><input type=\"text\" name=\"phone_login\" size=\"10\" maxlength=\"20\" value=\"$phone_login\" /></td></tr>\n";
#3. Posted:
Cyimking
  • E3 2016
Status: Offline
Joined: May 02, 201212Year Member
Posts: 1,129
Reputation Power: 34
Status: Offline
Joined: May 02, 201212Year Member
Posts: 1,129
Reputation Power: 34
I didn't test your code but you need to work on your HTML 5 / CSS 3. It's easy so just go on w3schools to learn more. Currently, you are using a deprecated tag (font tag) and you are missing the starting table tag as well.

At some point you will design this application so you won't have to echo a table. You will pass the data via JSON.. but back to your thread, I made some changes. I didn't not test it but it looks right.

Stylesheet.css
- For better organization, keep all styles in a CSS stylesheet. Never put any styles in a PHP file...


/* Global Setting */
.xxxxs-small-font {
   font-size: 1px;
}

.font-color-white {
   color: white;
}

/* Table Section */
.table-custom > td {
   color: white;
}


PHP File

*Comment -> Your value for the phone_login was probably "$phone_login" vs the actually value stored in that variable. Should be fixed now.



// I used table-custom because bootstrap uses table-* for their classes.
// So, I am just staying consisted with their model since you may use bootstrap in the future

echo "<table class='table-custom'>";
echo "<tr>";
echo "<td class='xxxx-small-font' align='left' colspan='2'></td>"
echo "<td></td>";
echo "</tr>"
echo "<tr>";
echo "<td align='right'>"._QXZ('Phone Login:')."</td>";
echo "<td align='left'><input type='text' name='phone_login' size='0' maxlength='20' value='" . $phone_login. "' /></td>";
echo "</tr>";
echo "</table>";


Regarding @Plugrealm comment... yes this will work but it's not the best practice. If you do not want each field to have white color text, then assign that specific tag a class. I called it "font-color-white" for this snippet.
#4. Posted:
CriticaI
  • Shoutbox Hero
Status: Offline
Joined: Nov 05, 201310Year Member
Posts: 2,743
Reputation Power: 449
Status: Offline
Joined: Nov 05, 201310Year Member
Posts: 2,743
Reputation Power: 449
when using echo I try to avoid using the style attribute because you usually have to use a lot of escape code.
Just give your elements classes or ids and use a style sheet or a style tag.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.