CSS Help - Page 1 - Post ID 178592

User 371048 Photo


Registered User
59 posts

Hi. I am trying to better understand CSS programming and am just lost on it for the most part. I have created a simplistic site to try and understand how objects and text can be placed anywhere on a site with CSS files, but I can see no relavance to positioning.

The test site is up at http://www.jayjaynet.com/jayjay/dev/index.htm

I created a few graphic squares, a few HTML links and a sliding menu. I have 3 stylesheets referenced (2 that the CSS Menu Creator builds, and one that I am trying to place all my items).

Below is my style sheet -- I know I must be doing something wrong but am just unsure what that is. (I have tried using the w3schools.com link to understand and am just not following items I guess. In looking at my style sheet, I attempt to position an item and use the position: relative; tag ... but I cannot figure out relative to what? Each time I move one thing, or resize a graphic, I seem to move other items and graphics as well. I would assume that the position: relative; tag would have a specific pixel on my site that all positions are relative to, but that certainly doesn't appear to be the case.

Here's my style sheet ... if someone can point me in the proper direction to understanding this better, I would very much be grateful. Thanks.


/* Begin Style Sheet */

body {
background-color: #FFFFFF;
text-align: center;
font-family: "Times New Roman";
font-size: 20px;
overflow-x: hidden;
}

#container {
margin-left: auto;
margin-right: auto;
width: 50em;
text-align: left;
}

#logo_left {
position: relative;
top: 20px;
left: 1px;
}

#logo_top_right {
position: relative;
top: -55px;
left: 710px;
}

#logo_bot_right {
position: relative;
top: -50px;
left: 710px;
}

#park_photo {
position: relative;
top: -50px;
left: 1px;
margin-top: 1px;
color: white;
}

#menu {
position: relative;
top: -1524px;
left: 1px;
}

#officers {
position: relative;
top: 269px;
left: 2px;
}

#news {
position: relative;
top: -326px;
left: 182px;
}

#events {
position: relative;
top: -921px;
left: 812px;
}

#music_fest {
position: relative;
top: -928px;
left: 812px;
}

#footer {
position: relative;
top: -1277px;
left: 2px;
}

#footer_text {
position: relative;
top: -1357px;
left: 1px;
}

#copyright {
position: relative;
top: -25px;
left: 350px;
color: #F2F393;
}

/* End Style Sheet */


-- me



User 122279 Photo


Senior Advisor
14,616 posts
Online Now

Hi,

If you haven't got some assistance until tomorrow evening (European time), I'll see what I can do. But right now I'm travelling and can't concentrate on css or any other coding.

But I'm sure someone will jump in here... :)
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 187934 Photo


Senior Advisor
20,266 posts

Jay Inger is awesome at css but appears to be away from a pc so I'll help you until she is back.:)
I'm still in the beginning phases of css also but know enough to be dangerous.:lol:
Can you pick one element on your page to work with so we can discuss what happens when you change certain things?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 184085 Photo


Ambassador
1,707 posts

I believe postion reletive is not all referring to one single pixle on the screen, but reletive to the last item displayed, so if you positioned 2 items 30px position reletive, the first one would be 30px and the next one will be 30 px from the end of the first item.

Also CSS is only half the equation, how you impliment the css in the html is also important so don't be suprised if we suggest changes to both. :)
Volunteering to help :)
http://www.tbaygeek.ca
My HTML play area
http://www.tbaygeek.ca/test/
User 184085 Photo


Ambassador
1,707 posts

I'll start off the process with this :

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)">
<meta name="created" content="Tue, 10 Jan 2012 15:12:40 GMT">
<meta name="description" content="Testing">
<meta name="keywords" content="Testing">
<Title>Auburndale Park Association</title>

<link rel="stylesheet" type="text/css" href="css/css2.css" media="screen">
<link rel="stylesheet" type="text/css" href="css/menu-menu.css" media="screen">
<link rel="stylesheet" type="text/css" href="css/superfish-vertical.css" media="screen">

<!--
body {
color:#000000;
background-color:#FFFFFF;
}
a { color:#0000FF; }
a:visited { color:#800080; }
a:hover { color:#008000; }
a:active { color:#FF0000; }
-->
</style>
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>


five lines from the bottom of the code I posted you have a </style> tag that does not have a <style> tag opening it before, so I suggest removing it as it will cause all sorts of unpredictible behaviours.

Next starting at the top of the code, the first signifigant tage we come to is the <HTML> tag, so lets start styling there :)


html {
background-color: #FFFFF2; /*pearly gates white */
}

body {
border 1px; /* just to help to position*/
}



Then we can start styling the body (I will drop back tonight :) )
Volunteering to help :)
http://www.tbaygeek.ca
My HTML play area
http://www.tbaygeek.ca/test/
User 371048 Photo


Registered User
59 posts

david wilson wrote:
I'll start off the process with this :
...

Next starting at the top of the code, the first signifigant tage we come to is the <HTML> tag, so lets start styling there :)


html {
background-color: #FFFFF2; /*pearly gates white */
}

body {
border 1px; /* just to help to position*/
}



Then we can start styling the body (I will drop back tonight :) )





So, I should put the background color and border before the <head> tag?

Or, is this in the small portion prior to the <Body> tag here:

<!--
body {
color:#000000;
background-color:#FFFFF2; /* pearly gates white */
}
a { color:#0000FF; }
a:visited { color:#800080; }
a:hover { color:#008000; }
a:active { color:#FF0000; }
-->




Thank you.
-- me



User 184085 Photo


Ambassador
1,707 posts

none of that information in your html is valid as it is not in between <style></style> tags, so at present it is being ignored and the info in your css file is what is being invoked, would you prefer my to recommend styling info in the css file or html file.

at present I am recommending we keep css in css and html in html.

I suggest the start of your html file look like this:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)">
<meta name="created" content="Tue, 10 Jan 2012 15:12:40 GMT">
<meta name="description" content="Testing">
<meta name="keywords" content="Testing">
<Title>Auburndale Park Association</title>

<link rel="stylesheet" type="text/css" href="css/css2.css" media="screen">
<link rel="stylesheet" type="text/css" href="css/menu-menu.css" media="screen">
<link rel="stylesheet" type="text/css" href="css/superfish-vertical.css" media="screen">

<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

</head>
Volunteering to help :)
http://www.tbaygeek.ca
My HTML play area
http://www.tbaygeek.ca/test/
User 184085 Photo


Ambassador
1,707 posts

and the start of your css look like this

html {
background-color: #FFFFF2; /*pearly gates white */
}

.border{border:dashed; border-color:red;}

body {

}


so here we have set the overall background colour to pearly gates white, created a class called border that we can use to help us position elements and have the body tag ready to style.

Volunteering to help :)
http://www.tbaygeek.ca
My HTML play area
http://www.tbaygeek.ca/test/
User 371048 Photo


Registered User
59 posts

david wilson wrote:
and the start of your css look like this

so here we have set the overall background colour to pearly gates white, created a class called border that we can use to help us position elements and have the body tag ready to style.




OK ... I have adjusted to that. I am not seeing the red dashed line, however. ... might be because I have a 2nd body tag in the CSS file? I did remove that 2nd one and the background turned black and the entire page shifted to the right.

-- me



User 184085 Photo


Ambassador
1,707 posts

OK, the border is a CLASS that we can evoke any time we need to outline something we are working on, this will become clear in a bit.

So in the css we have only one set for html, and one set for body. next lets switch to the html for a minute and toss in

<!-- right after the <body> tag and --> right before the </body> tag.

this is going to comment out all your webpage, but don't worry, we will reassemble it so that the tags in the html and css match, and both are ordered. Things are jumping around a little because I think there is some positioning and styling conflicts.

I see you are planning a logo.. do you have one decided on, or just know the size?? I'm thinking we can actually put the logo in the background rather than part of the container.

Volunteering to help :)
http://www.tbaygeek.ca
My HTML play area
http://www.tbaygeek.ca/test/

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.