div problem

M

Mr. X.

I see on some documentations (http://www.w3schools.com/tags/tag_DIV.asp)
that div has line break before and after.

I see there are sometimes, that there is a column spacing because of <DIV>
i.e I add a gif element, and after that another element (both are on <DIV>).
For the second object - I see that 0px is not the most left, so I should do
left:-30px in CSS-Style-Sheet.

Are there such known problem with <DIV>, and is there any documentation for
that problem ?

Thanks :)
 
J

Jonathan N. Little

Mr. X. said:
I see on some documentations (http://www.w3schools.com/tags/tag_DIV.asp)
that div has line break before and after.

Well ah, yeah that essentially describes a *block* element.
I see there are sometimes, that there is a column spacing because of <DIV>

Column spacing?
i.e I add a gif element, and after that another element (both are on <DIV>).

On? Do you mean *within*?
For the second object - I see that 0px is not the most left, so I should do
left:-30px in CSS-Style-Sheet.

No, not necessarily, are there margins, padding, is the absolutely
positioned?
Are there such known problem with <DIV>, and is there any documentation for
that problem ?

You are assuming it a problem, it more likely is your problem. URL
please and we can *see* what you are attempting.
 
M

Mr. X.

Some of my code (which this technique is used by many sites) :
<html>
.....
<body>
....
<div id = "wrap">
<div id = "header" />
<div id = "logo" />
<div id = "picture1" />
<div id = "picture2" />
</div>
<div id = "nav" ... />
</div>
<div id = "prolog" ... />
</body>
</html>

picture 2 position is absolute, but it is relative to the prior <div>
section
(if I do in css :
#picture2 {
position:absolute;
top:0;
left:0;
}

picture2 position is not realy 0 and 0, but it is relative to the prior
picture,
so that's why I did : top:-30px (you can reach to minus).

1. What is the concept of <DIV> with it's position, and how can I solve that
I won't need to calculate always the positions, that won't be relative (If I
want to replace picture1, and make its size grow from 20px to 100px, I
should change the whole css file, and there may be lot of elements) ?
2. Is there other good attitude instead of div (If I have many pictures, and
want to locate them on screen with some CSS style)
... and not, please not <TABLE> ... ?
3. I see that there is differenct behaviour for IE7 (if "prolog" is iframe
and has a background picture with attributes as :
background-repeat:no-repeat;
background-color:transparent;
background-attachment:fixed;) - What should I be aware from ?

Thanks :)
 
J

Jonathan N. Little

Mr. X. said:
Some of my code (which this technique is used by many sites) :
<html>

First of all a question. Why is it so difficult for some to grasp the
concept of posting a URL to the page and not post code? If you don't
know where the problem is how can you be sure you are included all the
relevant parts that include the source of the problem? The answer is,
you don't and you cannot. Post a URL.
....
<body>
...
<div id = "wrap">
<div id = "header" />

I don't think you understand at all what you are doing. Do you know what
'<div id = "header" />' means? Do you know th difference between *XHTML*
and *HTML*?

<snip rest of bogus code snippet>

1) Post a URL to an example page where you are having problems
2) Describe your problem
a) what you observe to be "incorrect"
b) what you wish to observe

Complete both steps and dramatically increase the possibility of
assistance.
 
D

dorayme

Ben C said:
You can make them position: fixed then. But they won't move when the page
scrolls.

If you want them to move when the page scrolls, leave them as position:
absolute, but just stuff them all in as children of BODY-- don't nest
them inside anything else.

If that breaks the semantic purity of your page, post a URL.

And post it if it does *not* break it, an example of "semantic purity"
is always a fine sight and cheers us all up.
 
M

Mr. X.

Problem has been solved.
Thanks anyway.

Look at the html code I have sent to this thread :
It is wrong.

1. <div id = "header" /> is enclosed in "/>", hence there are more openning
<div>
then closing </div>

2. You cannot do <div id = "picture1" />,
but should do :
<div id = "picture1">
</div>
(There must be </div>.
Maybe this situation is because <div> is using for many purposes, and what
I did is a tricky attitude, and when W3 invented <div> they assumed it
should have something beyond, and not just <div>).

I did as the above, and the attitude using <div> is so simple ...
only use <div> in html code, and in css use the absolute (inner <div>, even
it is at absolute position, is relative to the outer <div>).

Thanks :)
 
J

Jonathan N. Little

Mr. X. said:
Problem has been solved.
Thanks anyway.

Look at the html code I have sent to this thread :
It is wrong.

1. <div id = "header" /> is enclosed in "/>", hence there are more openning
<div>
then closing </div>

2. You cannot do <div id = "picture1" />,
but should do :
<div id = "picture1">
</div>
(There must be </div>.
Maybe this situation is because <div> is using for many purposes, and what
I did is a tricky attitude, and when W3 invented <div> they assumed it
should have something beyond, and not just <div>).

I alerted you to this problem earlier in the thread

http://message-id.net/<[email protected]>
Message-ID.net : [email protected]
 
S

Sherm Pendley

Mr. X. said:
2. You cannot do <div id = "picture1" />,
but should do :
<div id = "picture1">
</div>
(There must be </div>.
Maybe this situation is because <div> is using for many purposes, and what
I did is a tricky attitude

No, there's nothing tricky about it - it's just that no version of IE
actually understands XHTML. It doesn't parse it as XML; instead, it
uses its HTML parser and simply ignores the "extra" slashes in empty
elements that use the short form.

That's one reason why XHTML is pointless on today's web - because of
IE's lack of support, you're limited to using the subset of XHTML that
looks almost exactly like HTML. And, that being the case, you're just
as well off simply using HTML.

sherm--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,091
Messages
2,570,605
Members
47,225
Latest member
DarrinWhit

Latest Threads

Top