• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

css formating

I have the following php variable:

$sold= "<strong>&#62;&#62;&nbsp;SOLD</strong>";

If a record row is not empty the variable is correctly being shown on my web page:

<?php if (!empty($row_artGallery[artgal_stat])) {
      echo $space.$space.$sold; } ?>" />

I simple need to add a css style to this echo command such that the echoed value is RED in colour

On another note, please can someone tell me the correct css formating for Internet Explorer version 8 and above
to align div's and text left or centrally and to remove the border around images if they are hyperlinks. My css rules work perfectly in
Google chrome, Firefox and Safari but not in internet explorer
0
doctorbill
Asked:
doctorbill
  • 3
  • 2
  • 2
  • +2
6 Solutions
 
rgranlundCommented:
The php should be what you want and the the two CSS classes should work on all browsers including IE.  The "Border None" is what takes off the hyperlink around the item in IE.
$sold="<span class='sold'>SOLD</span>";

<style>
.sold{
font-family:Ariel;
font-size:13px;
color:RED;
padding-left:10px;
}
.sold img {
border:none;
}
</style>

Open in new window

0
 
gr8gonzoConsultantCommented:
I usually use <span> tags for adding CSS to specific words, like:

$sold = "<span style='color:#ff0000;'><strong>....</strong></span>";

Aligning DIVs and aligning text can be simple or complicated, depending on what you're trying to do. If you want to align the contents of a <div>, you would use the text-align CSS property. Aligning a <div> itself via CSS is often done by setting its "left" property, like left:50%.

Removing the border around linked images is accomplished by setting border=0 in the <img> tag.
0
 
hieloCommented:
$sold= "<strong style='color:red;'>&#62;&#62;&nbsp;SOLD</strong>";

Open in new window

0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
Ray PaseurCommented:
If you use the HTML5 doctype declaration you will get better cooperation out of the IE browsers.  Here's an example of a PHP script that generates an HTML5 web page.
<?php // RAY_html5.php
error_reporting(E_ALL);

// CREATE VARIABLES FOR OUR HTML
$xyz = 'Hello World. ';


// CREATE OUR WEB PAGE IN HTML5 FORMAT
$htm = <<<HTML5
<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
<meta charset="utf-8" />
<meta name="robots" content="index, follow" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<title>HTML5 Page in UTF-8 Encoding</title>
</head>
<body>
<p>$xyz</p>
</body>
</html>
HTML5;

// RENDER THE WEB PAGE
echo $htm;

Open in new window

0
 
doctorbillAuthor Commented:
This works:
---------------------------------------

$sold="<span class='sold'>SOLD</span>";

<style>
.sold{
font-family:Ariel;
font-size:13px;
color:RED;
padding-left:10px;
}
.sold img {
border:none;
}
</style>
---------------------------------------
I have just realised I need to also echo out an image in the same way - I presume I need to use img src tag ?
0
 
Ray PaseurCommented:
Yes, the <img> tag would be appropriate for rendering an image.
http://www.w3schools.com/tags/tag_img.asp
0
 
rgranlundCommented:
<?php
$sold="<span class='sold'>SOLD</span>";
$image="<div class='image'><img src='SOURCE'/></div>";

echo $image;
echo $sold;
?>

<style>
.sold{
font-family:Ariel;
font-size:13px;
color:RED;
padding-left:10px;
}
.sold img {
border:none;
}

.image{
width:100px;
height:100px;
}
.image img {
border:none;
}
</style>

Open in new window

0
 
doctorbillAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 83 points for rgranlund's comment #a39220631
Assisted answer: 84 points for rgranlund's comment #a39219536
Assisted answer: 84 points for gr8gonzo's comment #a39219544
Assisted answer: 83 points for hielo's comment #a39219545
Assisted answer: 83 points for Ray_Paseur's comment #a39219763
Assisted answer: 0 points for doctorbill's comment #a39220146
Assisted answer: 83 points for Ray_Paseur's comment #a39220502

for the following reason:

As usual - solution
0
 
doctorbillAuthor Commented:
Solution
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now