Krishp
Krishp

Reputation: 67

Styling problems using CSS

http://jsfiddle.net/AmKHx/

Hello all,

I linked my code on the top. My main problem is that I have my header, content and footer perfectly set that works with all websites. It does not have a scrolling feature or anything. Everytime I try to add the Intel Logo to the screen. It does what it is up there. I move it around and tweek it and then it works for one browser and not the other... It keeps changing. I want the logo to stick to the left perfectly along with the header I made with CSS. Also I want the Mobility Group Text at that height right next to the logo, but for some reason it always messes up my header content and footer as well when I paly with it. So pretty much I want The Logo on first then Mobility Group Right next to itand make it very smooth!

Also I have just learned html css and php and if you guys see something in my code that could be done smarter please let me know. I need critical feedback so that I can progress in learning these new languages better so that I can succeed in this field of programming!

Thank you in advance for all the input and advice!!

HTML CODE:

<div id="page">

        <div id="header">

            <h1><img src="http://wireless.fm.intel.com/test/logo2.png">

                <h2>Mobility Group</h2>



        </div>
        <div id="main"></div>

        <div id="footer"></div>

</div>

</body>

CSS CODE:

Html, body
{
        Padding:0;
        Margin:0;
        Height:100%;
}
#page
{
        Min-height:100%;
        position:relative;
        height:100%;
}
#header
{
        background-color:#115EA2;
        height:100px;
        width:97.5;
}
#main
{
        width:1300px;
        margin-left:auto;
        margin-right:auto;
        background-color:#F1F2F3;
        min-height:87%;
        height:auto;
        height:87%;
        margin:0 auto -50px;
        vertical-align:bottom;
}
#footer
{
        Position:fixed;
        Width:100%;
        Bottom:0;
        Height:50px;
        background-color: #115EA2;
}
#header h1
{
        position:absolute;
        text-align:left;
        left:0px;
        top:0px;
}
#header h2
{
        text-align:center;
        font-size:44px;
        color:#FFFFFF;
        left:0px;
        top:20px;
        font-weight:bold;
}

Upvotes: 0

Views: 132

Answers (2)

Shomz
Shomz

Reputation: 37711

I'm still not sure I understood the question, but here's what can you do to make it more natural looking. Close the h1 tag, don't make it absolutely positioned, but rather make it float left. The same thing goes to the h2 element. And since the original image is missing, I've put another one, and fixed its height to 60px.

It's basically this:

#header h1 {
    text-align:left;
    left:0px;
    top:0px;
    float: left;
} 
#header h1 img {
    height: 60px;
}
#header h2 {
    text-align:center;
    font-size:44px;
    color:#FFFFFF;
    left:0px;
    top:20px;
    font-weight:bold;
    float:left;
}

See the results here: http://jsfiddle.net/AmKHx/1/ It should look the same in every modern browser.

Also, try not to use capital letters for CSS attributes - it's a standard to use lower case, and even some browsers might not like it.

Upvotes: 1

SasaT
SasaT

Reputation: 731

Do you have a reset sheet?

Copy this to a new css file, call it reset.css and then load it in your page before you load your main css.

html{color:#000;background:#FFF}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0}
table{border-collapse:collapse;border-spacing:0}
fieldset,img{border:0}
address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal}
ol,ul{list-style:none}
caption,th{text-align:left}
h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}
q:before,q:after{content:''}
abbr,acronym{border:0;font-variant:normal}
sup{vertical-align:text-top}
sub{vertical-align:text-bottom}
input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit}
input,textarea,select{*font-size:100%}
legend{color:#000}

Upvotes: 0

Related Questions