PDA

View Full Version : Dreamweaver adding spaces in my code


wolfmanbc
04-11-2011, 03:19 AM
In code view I have a bunch of images all on separate lines. For some reason dream weaver is adding a couple of spaces between the images, Like this:

<img src="../images/fmc/fmc_01.png">
<img src="../images/fmc/fmc_02.png">
<img src="../images/fmc/fmc_03.png">

There must be some auto formatting happening but I don't know how to change it.

The only way to remove the spaces is to have the code for the images back to back, Like this:

<img src="../images/fmc/fmc_01.png"><img src="../images/fmc/fmc_01.png"><img src="../images/fmc/fmc_01.png">

This is a pain. Anyone know how to change this?

lhemmerich
04-11-2011, 05:13 AM
Nor sure I see the problem..when displayed in the browser the result will be the same.. why do you want the code on the same line.

Larry

wolfmanbc
04-11-2011, 05:40 AM
I dont want the code on the same line. Its much easier to deal with, read and edit if they are on separate lines of code.

The problem is, in the browser it does not display the same. It should. The images should line up next to each other in the browser no matter if the code is side by side or if I spread things out in the code.

I think dreamweaver has some sort of setting thats creating spaces when I drop the code to separate lines.

edbr
04-11-2011, 07:04 AM
show the actual code where it appears on separate lines, it should make no difference

johnMoss
04-11-2011, 07:07 AM
The images as you have them coded on separate lines are spacing one character apart from each other because by default the browsers will render this one space whenever there is empty space in the code of a positioning element. The best (and proper) way to handle images is to utilize CSS to position them.
Ed, I stand corrected?

edbr
04-11-2011, 07:18 AM
no it looks like i do. i will have to try this as ive not come across it before to be honest. because they are on new lines it shouldn't add spaces i would say

edbr
04-11-2011, 07:21 AM
no i tried to be sure and it made no difference (in ff at least) i asked the code incase they were in paragraph tags

johnMoss
04-11-2011, 07:23 AM
If those images are inside a <p> container, which I'm assuming here, that behavior would occur for sure...

johnMoss
04-11-2011, 07:24 AM
This is amusing, we're posting within seconds... They gotta be in p's...

gentleone
04-11-2011, 10:45 AM
I did a test too and I noticed also that if they are on the same line in code view the space between them disappears (I've tested only in Firefox by the way).
I'm not sure why's that. I zeroed out the margin, but still. The only fix I could came up with is to add a float: left to the img tag in the CSS.