Okay, I am embarrassed to be asking for help on this, but obvious my HTML and CSS are rusty?!
When a user changes their e-mail, I display a message confirming the change.
I would like the e-mail to be bold, indented maybe 2em, and have maybe 0.5em above and below it, so that it stands out from the other text.
For the life of me, I cannot get the code below to recognize my style?!
<div id="pageMidCol_1">
<div id="boxMessage">
<h1>E-mail Changed</h1>
<p>Your e-mail has been changed, and a confirmation e-mail sent to:<br />
<span id='indentText'><b>username@mail.com</b></span></p>
<p>Please log in using the new e-mail. (2128)</p>
<a class="button" href="http://local.debbie/account/log-in.php">Log In</a>
</div>
</div><!-- End of #MIDDLE -->
Debbie, the style recommended by Ralph works for me in Firefox and IE8. I see:
[b]E-mail Changed[/b]
Your e-mail has been changed, and a confirmation e-mail sent to:
[b]username@mail.com[/b]
Please log in using the new e-mail. (2128)
Log In
Could there be other code overriding your styles?
PS: you could assign #indentText to the <b> tag and omit the <span> if you wish.
Try the following test page in your browser and see how it behaves. What browser are you using?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<!--
http://www.sitepoint.com/forums/showthread.php?958892-Problem-with-Indent
Thread: Problem with Indent
2013.01.20 21:03
DoubleDee
-->
<head>
<title>template</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="content-language" content="en-us">
<style type="text/css">
#boxMessage {
outline:1px solid magenta;
}
#boxMessage p {
padding: 0.5em 0 0.5em 0;
background-color:#ccf;
}
#boxMessage #indentText {
display:block;
padding: 0.5em 0 0 2em;
background-color:#fcc;
}
</style>
</head>
<body>
<div id="pageMidCol_1">
<div id="boxMessage">
<h1>E-mail Changed</h1>
<p>Your e-mail has been changed, and a confirmation e-mail sent to:
<b id='indentText'>username@mail.com</b></p>
<p>Please log in using the new e-mail. (2128)</p>
<a class="button" href="http://local.debbie/account/log-in.php">Log In</a>
</div>
</div> <!-- End of #MIDDLE -->
</body>
</html>
This may be a case of where FireFoxâs cache is causing issues AGAIN. :mad:
Right now Iâm listening to Casey Kasemâs Countdown, and weâre on #5, but after my show is over, Iâll close all instance of FireFox, and see if that helps?!
If this solves the problem, then eliminate the modifiers one at a time until you determine which property is being overridden; then try to find out where the override is occurring and you should be able to address your selector so it wins the contest.
The !important modifier shouldnât be considered a solution unless there is no other way to overcome the specificity issue.
There is a recent thread that gives some great information about specificity:
A bit of useful trivia for your notebook:
Ctrl+F5 (or) Ctrl+Shift+R will force a full reload of a page in Firefox.
echo '<h1>E-mail Changed</h1>';
echo '<p>Your e-mail has been changed, and a confirmation e-mail sent to:</p>';
echo '<p id="newEmailAddy">' . str2htmlentities($newEmail) . '</p>';
// echo '<p>Your e-mail has been changed, and a confirmation e-mail sent to:';
// echo '<span id="indentText"><b>' . str2htmlentities($newEmail) . '</b></span></p>';
echo '<p>Please log in using the new e-mail. (2128)</p>';
echo '<a class="button" href="' . BASE_URL . '/account/log-in.php">Log In</a>';
<!-- MIDDLE COLUMN -->
<div id="pageMidCol_1">
<div id="boxMessage">
<h1>E-mail Changed</h1><p>Your e-mail has been changed, and a confirmation e-mail sent to:</p>
<p id="newEmailAddy">username@mail.com</p>
<p>Please log in using the new e-mail. (2128)</p>
<a class="button" href="http://local.debbie/account/log-in.php">Log In</a>
</div>
</div><!-- End of #MIDDLE -->
When I select this code in FireBugâŚ
<p id="newEmailAddy">username@mail.com</p>
âŚI see this in the Style window off to the sideâŚ
#boxMessage p {
padding: 0.5em 0;
}
âŚwhich is active, and then I see this below itâŚ
p {
padding: 0 0 1em;
}
âŚwhich has a STRIKETHOUGH through it saying that my #boxMessage style is over-riding my default p style.
The difference may be that leading âpâ in p#newEmailAddy which makes the selector more specific. Yesterdayâs code doesnât appear to have included that leading âpâ.
That message about specificity would be a worthwhile read.
In what I posted last night, you are correct. But before coming to SP, I did have p#newEmailAddy in my code, and it didnât help. (May have been that notorious FireFox Caching issueâŚ)
That message about specificity would be a worthwhile read.
Yes, I did read the link you provided, and I think I knew all of that.
(I think when I re-write my site in v3.0 I need to completely scrap my CSS and start from scratch. It has become unwieldy, and its messiness probably complicates issues like this one.)