PDA

View Full Version : weird css happenings


davidj
10-16-2008, 06:37 AM
ok

In the past few weeks i have been like one of those free divers except my water has been CSS. I am getting over the natural knee jerk reaction to reach for my air tank called tables and i am swimming deeper.

i noticed an issue where form field meets <label tag

a space between the closing field tag and the starting label tag is actually rendered by FF and IE and its not a default margin issue.

Is there a reason for this?

example...


<input name="field1" type="text" id="field1" /> ^ <label for="field1">

edbr
10-16-2008, 07:15 AM
not sure . do you use a class for your form? an ex
.cssform p{
width: 300px;
clear: left;
margin: 0;
padding: 5px 0 8px 0;
padding-left: 155px; /*width of left column containing the label elements*/
border-top: 1px dashed gray;
height: 1%;
}

.cssform label{
font-weight: bold;
float: left;
margin-left: -155px; /*width of left column*/
width: 150px; /*width of labels. Should be smaller than left column (155px) to create some right margin*/
}

.cssform input[type="text"]{ /*width of text boxes. IE6 does not understand this attribute*/
width: 180px;
}

.cssform textarea{
width: 250px;
height: 150px;
}

davidj
10-16-2008, 01:18 PM
yes

i am styling the form that way but had no styles set when i noticed this

domedia
10-16-2008, 02:08 PM
The reason is default margins on form elements

Rob_Che
10-16-2008, 04:51 PM
The reason is default margins on form elements
That's what i was going to say.

it's worth noting that H1/2/3 have defaults too...
and paragraph elements have their own margins etc set as default.
They will all be over-ridden with margin/padding: 0 ; though...

RC

davidj
10-16-2008, 04:57 PM
your both wrong

when i deleted the space all was fine. Try it!

i had zero'd all defaults

domedia
10-16-2008, 05:11 PM
ok, so show the CSS next time you have a style question so we don't waste our time. The advice you got was spot on and correct based on the info you gave.

on you deleting the space:
Inline elements a space is always a space. How else are you going to have space between words? This is not a style or CSS issue or something you can 'fix', it's the nature of inline text.

davidj
10-16-2008, 05:15 PM
OK, so show the CSS next time you have a style question so we don't waste our time.

your supposed to use smiley so i don't get the wrong impression!

also

you decided your time had been wasted at the beginning of your post yet you continued to waste your time by adding to the post after the decision had been made!

domedia
10-16-2008, 05:17 PM
your supposed to use smiley so i don't get the wrong impression! No you got it right, you're just confusing yourself. I could have used a pissed of smiley in case there was any confusion.
Not pissed anymore though :)
you decided your time had been wasted at the beginning of your post yet you continued to waste your time by adding to the post after the decision had been made! Just passing on some knowledge..

davidj
10-16-2008, 05:31 PM
OK

just so i understand...

my first post gave this example...


<input name="field1" type="text" id="field1" /> ^ <label for="field1">


this example was enough for you to identify the issue...


Inline elements a space is always a space. How else are you going to have space between words? This is not a style or CSS issue or something you can 'fix', it's the nature of inline text.


and yet you still posted...


OK, so show the CSS next time you have a style question so we don't waste our time.


so that was quite unnecessary as i gave you all the information which was required for you to answer the question which you did. (in the end!)

whats with the attitude

domedia
10-16-2008, 05:40 PM
I took it for granted this was a CSS question that's all. Didn't realize you did not know what a space is in html.. :-/

davidj
10-16-2008, 05:45 PM
cheers for that

why dont you use that style of response with all DWC members

then you will come across like a dick to them too :-D

domedia
10-16-2008, 05:53 PM
then you will come across like a dick to them too :-D Then we'd have no members left! :mrgreen:

davidj
10-16-2008, 05:54 PM
of course we would

you just have to use a smiley

2bz2p
10-16-2008, 06:17 PM
:lol: :lol: :lol:

Thanks needed that, helped with the CSS Migrain.

Walks over to the sand games arcade......

davidj
10-16-2008, 06:21 PM
your welcome

neon is back :grin: !

ive missed him

2bz2p
10-16-2008, 06:46 PM
your welcome

neon is back :grin: !

ive missed him

:confused: Huh :confused:

Rob_Che
10-16-2008, 07:34 PM
your supposed to use smiley so i don't get the wrong impression!

:lol: HAHA!

davidj
10-16-2008, 07:44 PM
err

dont laugh

i never gave the signal..... wait ......

:grin: :grin: :grin:

go for it