Solved

css formating

Posted on 2013-06-04
9
279 Views
Last Modified: 2013-06-05
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
Comment
Question by:doctorbill
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 7

Assisted Solution

by:rgranlund
rgranlund earned 168 total points
ID: 39219536
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
 
LVL 35

Assisted Solution

by:gr8gonzo
gr8gonzo earned 83 total points
ID: 39219544
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
 
LVL 82

Assisted Solution

by:hielo
hielo earned 83 total points
ID: 39219545
$sold= "<strong style='color:red;'>&#62;&#62;&nbsp;SOLD</strong>";

Open in new window

0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 166 total points
ID: 39219763
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
 

Author Comment

by:doctorbill
ID: 39220146
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
 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 166 total points
ID: 39220502
Yes, the <img> tag would be appropriate for rendering an image.
http://www.w3schools.com/tags/tag_img.asp
0
 
LVL 7

Accepted Solution

by:
rgranlund earned 168 total points
ID: 39220631
<?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
 

Author Comment

by:doctorbill
ID: 39221372
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
 

Author Closing Comment

by:doctorbill
ID: 39221373
Solution
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question