Anyone mind checking my code on this?

I want to learn to do things the correct way. Did I code the top box with the Twitter icon correctly on http://bloggerfusion.com/dev/

Here is the CSS:

#social {
  background: #f0f2eb url(/images/socialbg.png) no-repeat;
  width: 280px;
  height: 36px;
  float: right;
  color: #f0f2eb;
}

#twitter {
  width: 152px;
  margin: 5px 0 0 17px; 
}

#twitter img {
  margin: 0 5px 0 0;
  vertical-align:middle
}

#social a {
  color: #f0f2eb; 
  text-decoration: none;
  font-size: 81.3%;
}

#social a:hover{
  color: #e5f798;  
}

Andy the HTML

<div id="social">
          <div id="twitter"><a href="http://twitter.com/bloggerfusion" title="@bloggerfusion"><img src="/images/twitter.png">@bloggerfusion</a>
          </div>          
        </div>

As an added level of difficulty, is there a way to bloggerfusion change color on hover when the Twitter icon is moused over while keeping the @ sign a different color?

I really appreciate your time.

This background image/sprite thing has me completely stumped. I can’t figure out how to modify the code to make it work for my image.

Well, thanks to your help I got the sidebar finished. I am happy that it looks the way I want, I just hope it is coded correctly. I would prefer to have it both ways if at all possible.

Again, I appreciate the help.

I think it is clear that you know what you are doing so I am okay with how you would do it. Thanks again.

Hi,

It depends exactly how you want them but I would center them with text-align:center on a parent and then just a small margin left and right to them.

I would also remove the hr and apply the border to the top of the div instead to save an element.

As you have more than one ad then we can assume that you have a list of ads to place so a list would be a better choice than a div.

The anchor that runs into the p element is not semantically correct so I would change the structure a bit like so.


<div id="sidebar">
    [B]<p class="postJob">[/B]<a href="#" title="Post A Job"><img src="http://dev.bloggerfusion.com/images/postjobbutton.png"></a>[B]<em>Free for a limited time.</em></p>[/B]
    [B]<ul class="adBlock">
        <li><img src="http://dev.bloggerfusion.com/images/125ad.png"></li>
        <li><img src="http://dev.bloggerfusion.com/images/125ad.png"> </li>
    </ul>[/B]
</div>


The css is then amended as follows:


/* Sidebar CSS */
#sidebar {
    width: 280px;
    float: right;
}
.postJob {
    height: 136px;
    background: #e4e5e1;
    text-align: center;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
    font-size: 1.125em;
    color: #333;
   [B] margin:0;[/B]
}
.postJob img, .[B]postJob em[/B] {
    margin: 14px 0 0 0;
}
[B].postJob em {
    display:block;
    fon-style:normal;
    font-weight:normal;
}
.adBlock {
    border-top: 1px dotted #333;
    margin: 15px 0 15px 0;
    text-align:center;
}
.adBlock img {margin:5px}
.adBlock ul{margin:0}
.adBlock li{display:inline}[/B]



hr {
    border: 1px dotted #333;
    border-style: none none dotted;
    margin: 15px 0 15px 0;
}
/* End Sidebar CSS */


Of course these things are open to interpretation but that’s how I’d do it.

I guess because I don’t know any better. I am trying to learn and really appreciate the help.

Hi,

You have a missing doctype which you must put back in or all versions of IE will be in quirks mode.

The links to the IE css files don’t seem to be going anywhere either :wink:

These ones:


<!--[if lte IE 7]>
        <script src="js/IE8.js" type="text/javascript"></script><![endif]-->
<!--[if lt IE 7]>
        <link rel="stylesheet" type="text/css" media="all" href="css/ie6.css /> <![endif]-->

You also have not placed the sticky footer code for IE8 into the html as instructed (see the css faq at the top of the forum for an updated version of that routine you are using (which was borrowed from me anyway :)))

There is no need for your twitter div as it can all be done in one element.

e.g.


#social {
    background: #f0f2eb url(http://bloggerfusion.com/images/socialbg.png) no-repeat;
    width: 265px;
    height: 31px;
    float: right;
    color: #f0f2eb;
    padding:5px 0 0 15px;
   margin:0;
}
#social img {
    margin: 0 8px 0 0;
    vertical-align:middle
}
#social a {
    color: #f0f2eb;
    text-decoration: none;
    font-size: 81.3&#37;;
}
#social a:hover {
    color: #e5f798;
}
#social a b{color:white}
#social a:hover b{color:red}



<div id="main">
       [B] <p id="social"> <a href="http://twitter.com/bloggerfusion" title="@bloggerfusion"><img src="http://bloggerfusion.com//images/twitter.png"><b>@</b>bloggerfusion</a></p>[/B]
    </div>

I’ve wrapped a b element around the @ symbol so that you can color it as you like. You can either change it on hover or keep it the same color.

Full code:


<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" >
<meta name="#" keywords="#">
<meta name="#" description="#">
<title>Blogger Fusion</title>
<link rel="stylesheet" href="style.css" type="text/css" >
<style type="text/css">
/* Reset */

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-size: 100%;
    vertical-align: baseline;
    background: transparent;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after, q:before, q:after {
    content: '';
    content: none;
}
/* remember to define focus styles! */
:focus {
    outline: 0;
}
/* remember to highlight inserts somehow! */
ins {
    text-decoration: none;
}
del {
    text-decoration: line-through;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
    border-collapse: collapse;
    border-spacing: 0;
}
/* End Reset */

html, body {
    height: 100%;
    background: #f0f2eb;
    font-family: arial, helvetica, serif;
    font-size: 100%;
}
#wrap {
    min-height: 100%;
    width:940px;
    margin: 0 auto;
}
* html #wrap {
    height:100%
}
#main {
    overflow:auto;
    padding-bottom: 45px; /* must be same height as the footer */
}
#social {
    background: #f0f2eb url(http://bloggerfusion.com/images/socialbg.png) no-repeat;
    width: 265px;
    height: 31px;
    float: right;
    color: #f0f2eb;
    padding:5px 0 0 15px;
}
#social img {
    margin: 0 8px 0 0;
    vertical-align:middle
}
#social a {
    color: #f0f2eb;
    text-decoration: none;
    font-size: 81.3%;
}
#social a:hover {
    color: #e5f798;
}
#social a b{color:white}
#social a:hover b{color:red}
/* Footer CSS */

#footer {
    position: relative;
    margin-top: -45px; /* negative value of footer height */
    height: 45px;
    clear:both;
    background: #333;
}
#footerText {
    width:940px;
    font-size: 81.3%;
    margin: 0 auto;
    padding: 15px 0 0 0;
}
#footerText a {
    color: #f0f2eb;
    text-decoration: none;
}
#footerText a:hover {
    color: #e5f798;
}
#footerLinks li a {
    margin: 0 20px 0 0;
    display:inline;
    float: left;
    text-align:left;
}
#footerCopy {
    float: right;
    color: #b0aa98;
}
/* Opera Fix */
body:before {/* thanks to Maleika (Kohoutec)*/
    content:"";
    height:100%;
    float:left;
    width:0;
    margin-top:-32767px;/* thank you Erik J - negate effect of float*/
}
</style>
<!--[if !IE 7]>
    <style type="text/css">
        #wrap {display:table;height:100%}
</style>
<![endif]-->
<!--[if IE]>
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<!--[if lte IE 7]>
        <script src="js/IE8.js" type="text/javascript"></script><![endif]-->
<!--[if lt IE 7]>
        <link rel="stylesheet" type="text/css" media="all" href="css/ie6.css /> <![endif]-->
</head>
<body id="index">
<div id="wrap">
    <div id="main">
        <p id="social"> <a href="http://twitter.com/bloggerfusion" title="@bloggerfusion"><img src="http://bloggerfusion.com//images/twitter.png"><b>@</b>bloggerfusion</a></p>
    </div>
</div>
<div id="footer">
    <div id="footerText">
        <div id="footerLinks">
            <ul>
                <li> <a href="#">All Jobs</a> </li>
                <li> <a href="#">Post A Job</a> </li>
                <li> <a href="#">Contact Us</a> </li>
            </ul>
        </div>
        <div id="footerCopy"> &copy; Blogger Fusion | Design by <a href="http://www.andycrofford.com" title="AndyCrofford.com">Andy Crofford</a> </div>
    </div>
</div>
</body>
</html>


Hope that helps :wink:

So I can have an image under text without that image being a background? Also, change that image on hover?

Thanks

Thank you for doing that. This part is very challenging so I will need to take some time to play around with it and get to understand what is going on.

Thanks again.

Okay, but the other way I was having an issue with the left border not lining up against the right border of the next item.

Any idea how I can fix it so it does?

Hi,

You can see that my example is working fine in mac safari and Firefox :slight_smile:

The problem is that you have given a width to the form element in that nav that is too big to fit. The left nav items are not a specific width so you can’t then give the form element a width because you never know how big those other elements will be and how wide the text will be rendered in different browsers.

If you look at my example you’ll see that the form has no width and works fine. Just remove the width and the input will snap back in place.

This next piece is important because I have mentioned and fixed it several times for you but you still have not removed the conditional comments from the css file. You must remove them and place the conditional comments in the head as I have shown already. Ie8 won’t work properly unless you do this.



/* IMPORTANT

You also need to include this conditional style in the <head> of your HTML file to feed this style to IE 6 and lower and 8 and higher.

<!--[if !IE 7]>
    <style type="text/css">
        #wrap {display:table;height:100&#37;}
    </style>
<![endif]-->

*/


That must not be in the css file.

It should be in the head:


<!--[if !IE 7]>
    <style type="text/css">
        #wrap {display:table;height:100%}
    </style>
<![endif]-->
[B]</head>[/B]

Okay, so my site looks exactly how I want it (dev.bloggerfusion.com) in all Windows browsers I have tested (IE, Firefox, Safari, Chrome) but in MAC OS Safari and Firefox it looks like this:

http://bloggerfusion.com/macosexample.png

Any idea on what I can do to fix this.

No problem and that’s why I asked the question so that you think about the structure a little bit more. :slight_smile:

Your code wasn’t bad anyway so you are doing well :slight_smile:

Just keep asking questions and we’ll try our best to answer them.

[ot]

(although html5 rather stupidly says we shouldn’t use cite for the authors name so you can remove it if it worries you but hopefully they will see sense and change it back).

Well, I completely agree with Emily’s awesome sentiment regarding that factoid. : )

It seems a lot of the stranger things proposed or left out of the HTML5 spec seem based on “but authors write it wrong” or “but browsers don’t do it right”, both poor reasons. Especially the first one.[/ot]

Looks like the green bar would be mainly a list structure.

The details underneath could also be a list with each list element being the row.

The red text would be a suitable level heading tag followed underneath by those details (which may also be a list if you have many similar items.)

The content on the right would need to be floated to the right and be the first item in the row.

If you want vertical alignment like a table then that could be awkward for older browsers. You can just float the right element to the right and approximate the center but if you wanted it to match half a dozen lines of text on the left then it would get complicated and you would need display:table or perhaps display:inline-block methods.

Hi,

I’ve put up a small demo here so see if you can de-construct it first.

http://www.pmob.co.uk/temp/bf.htm

If you get stuck or don’t understand how it works then shout.

It alls seems so obvious now :). No idea what I was thinking. Again, I really appreciate your help. I owe you big time.

Hi,

You should (almost) never cause a re-flow on hover. That is to say that when you make a change to an element on hover you should not cause its dimensions to get bigger or smaller or the page will reflow and jump.

What this means is that you should make sure the element’s overall dimensions don’t change. If you apply padding on hover then it will jump so make sure you have applied the padding to the normal state first and then there will be no jump.

You can add borders on hover but at the same time you should reduce the padding by the same amount on hover so overall dimensions don’t change. (Border-radius is not an issue as it doesn’t affect the flow.)

Your code can be changed to this:


[B]ul#mainNav [/B]{
    width: 575px;
    float: right;
   [B] margin: 39px [/B]0 0 0;
}
#mainNav li a {
    margin: 0 34px 0 0;
    display:inline;
    text-align:left;
    float: left;
    font-size: .875em;
    font-style: italic;
    color: #333;
    text-decoration: none;
[B]    padding: 7px 12px 7px 12px;[/B]
}
#mainNav li a:hover {
 [B]   background: #333;
    color: #f0f2eb;
    font-style: italic;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;[/B]
}



    <div id="logo"> <a href="http://www.bloggerfusion.com" title="Home"><img src="http://dev.bloggerfusion.com/images/logo.png"></a> </div>
         [B]   <ul id="mainNav">
            [/B]    <li> <a href="#">All Jobs</a> </li>
                <li> <a href="#">Post A Job</a> </li>
                <li> <a href="#">Contact Us</a> </li>
         [B]   </ul>[/B]
        </div>

Again there is no need for a div around the ul as the ul is a perfectly good wrapper in it’s own right.

I thought I looked for this but couldn’t find it. Well, you were correct. Thanks for the help.

Andy

Won’t I need to have a separate one to position the RSS Feeds one on the other side of that divider?