View Full Version : cut & paste div problem

04-01-2011, 06:39 AM
Has anyone ever cut and pasted a div and right after you did that the layout gets completely screwed up and you try to undo but that doesn't work...

It has happened before and I had to re code the whole page...

and it just happened again and I am trying to figure out the cause.

Basically I had a image within a div. That div was inside a parent sidebar div.
I decided I wanted to make a php include file for the sidebar so I just cut the image div out of the sidebar parent div and pasted it right below it...

as soon as I did that my sidebar background color that was extending all the way down to the footer jumped up to the image..
also there is now a gap between my nav div and content div...
I fixed the gap by top by making sure the wrapper background color was selected which it was but oddly after selecting it again it appeared...

anyway it is a weird problem and it has happened to me before...

Is cutting and pasting divs a no no?

I am just trying to understand where I went wrong here...

It sucks because in a normal html coding mistake I can just undo and it is fine but when css is involved i can't and it sucks because I forget to make a backup from time to time named something differently...

04-01-2011, 07:00 AM
in code view?

04-01-2011, 07:03 AM
yes i copied and pasted the div in code view...

04-01-2011, 07:05 AM

this might help you....

04-01-2011, 07:23 AM
odd there are a few unclosed tags si i wonder if that causes your problem. have a work through thes , close thm then try again

Result: 0 errors / 11 warnings

line 6 column 1 - Warning: <link> element not empty or not closed
line 7 column 1 - Warning: <link> element not empty or not closed
line 8 column 1 - Warning: <link> element not empty or not closed
line 9 column 1 - Warning: <link> element not empty or not closed
line 65 column 65 - Warning: unescaped & which should be written as &amp;
line 78 column 67 - Warning: unescaped & which should be written as &amp;
line 34 column 5 - Warning: <div> anchor "nutritionbodyheader" already defined
line 38 column 1 - Warning: <div> anchor "nutritionbodyheader" already defined
line 65 column 76 - Warning: trimming empty <span>
line 78 column 72 - Warning: trimming empty <span>
line 90 column 69 - Warning: trimming empty <span>

04-01-2011, 07:31 AM
the first 4 are just google web fonts

not sure what the next 2 mean for unescaped... here is the code

<li class="button"><a href="#" class="green">Services & Nutrition<span></span></a></li>

the last 3 reference the spans which should not cause a problem...

and the other 2 are just referencing 2 divs that it says are already defined but they are for 2 different headers throughout my content text...

i dunno...

04-01-2011, 07:39 AM
i'll figure it out... I just didn't know if that was something you had ever come across.... cut and paste a div below a div and it mess up the layout but then cut and paste again and put it right back where it was but the problem still exist... just weird... ;o)

04-01-2011, 07:41 AM
yes it means close them />. im only guessing here but if links are noyt closed it can trow errors on your page , misreading the next closed div for example , thats why i suggested cleaning them up

04-01-2011, 07:52 AM
which tags are not closed?

04-01-2011, 07:54 AM
line 6-9 are google webfont links copied straight from the google site...

04-01-2011, 08:19 AM
i know what they are , i also have seen this cause a problem as well

04-01-2011, 08:22 AM
but there aren't any unclosed tags... that is why i am confused...

04-01-2011, 08:27 AM
and my page has viewed just fine with all that code you suggested I look at for days now.... my questions was about the cut and paste problem... i was just wondering if moving a div by cutting and pasting and then moving it back can cause problems within the css parent div structure or something because that is almost what seems to be happening...

04-01-2011, 08:52 AM
no of course not
but there can be conflicct when a tag is considered unclosed by a browser, thats all im suggesting , i did a quick search and found other problems caused by the google links
<link href='http://fonts.googleapis.com/css?family=Raleway:100' rel='stylesheet' type='text/css ' />
i use google fonts but i add them to mty style sheets. these are only warnings so yes it is not such a problem but trying would be easier than arguing why IMO .

04-01-2011, 03:39 PM
my bad dude...
I didn't even notice those were unclosed...
I ASSUMED (<--- yeah i know...) that being copied straight from Google there would not be an issue...
I closed them... however, I am still wondering...

Have you ever had that cut and paste issue happen I am talking about?

Or what do you think it might be?

04-02-2011, 12:45 AM
not a problem, frankly its a stab in the dark , just its such an easy fix its one i would eliminate first if i were trying to debug.
I did see while yahoogling a case or three where not closing them caused probs though, for example only calling the first font and not subsequent.

No i have never seen this problem . in code view its basically an editor as notepad+ would be so my next suggestion (if the above didnt help) would be this, if you move a div (or any tag) perhaps you are moving into a different parent div and it is inheriting different attributes than before. is kind of difficult without seeing before and after examples though

going back to the google fonts a min if you add for example
@import url(http://fonts.googleapis.com/css?family=Raleway);
to your style sheet it maybe a better way of approaching it

04-02-2011, 12:50 AM
ok cool

do you have an example site of that in play so I can check out the code and make sure I do it correctly?