Solved

css formating

Posted on 2013-06-04
9
274 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
  • 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 34

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
 
LVL 108

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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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 108

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now