What is the required cloud clearance in G airspace when there are clouds just above in class E airspace? This is my first question here and I am about to start my Private Pilot License (PPL). 

Now I am flying in my Flight Simulator X. So, I am at KDKK airport. It has an elevation of 692 MSL . I got my ATIS report 2100 MSL scattered and 3000 MSL broken. The airport is in class G and the weather minimum here is clear of clouds. 

At 1200 AGL we have class E airspace and 500 feet below clouds rule applies here. The question is: flying at 1800 I will still be flying in G airspace, but will not comply with 500 feet class e rule and will be closer than 500 feet to the clouds. Is it legal? 

And the second question: still didn't find clear definition of "clear of clouds". Is that mean that there are no clouds at all? or it could be clouds, and I can fly very close to them, but I can't get through the clouds?
KDKK is under a Class E shelf starting at 700 ft AGL (Magenta vignette around the airport).  If the airport elevation starts at 692’ MSL, the Class E shelf will begin at 1392 ft MSL.  Therefore operation at 1800 ft MSL above KDKK will put you in Class E airspace and subject to the VFR weather minimums of 3 sm visibility and 1000 ft above / 500 ft below / 2000 ft lateral cloud clearances.

As the the second question, clear of clouds means remain in a position outside of clouds and a flightpath which will not place you in immediate risk of entering a cloud.