Siman 627
Presented here for study, not as a practical ruling. The Shulchan Aruch rules by Sephardi custom, the Rema's glosses by Ashkenazi custom, and the Kitzur follows Ashkenazi custom. For a practical question, ask your rabbi.
א צָרִיךְ לִישֵׁב בַּאֲוִיר הַסֻּכָּה. הַיָּשֵׁן תַּחַת הַמִּטָּה בַּסֻכָּה, אִם הִיא גְּבוֹהָה י' טְפָחִים, לֹא יָצָא.
1 The Laws of Sitting in the Sukkah, 4 Seifim: (One must sit in the air of the sukkah) One who sits under a bed in the sukkah - if it is higher than 10 tefachim he has not fulfilled his obligation.
ב הַיָּשֵׁן תַּחַת הַכִּילָה בַּסֻכָּה, אִם אֵינָהּ גְּבוֹהָה עֲשָׂרָה טְפָחִים אוֹ שֶׁאֵין לָהּ גַּג רָחָב טֶפַח, יָצָא.
2 One who sleeps under a slanting canopy that surrounds a bed in a sukkah - if it is not higher than 10 tefachim or if it has no roof the width of a tefach, he has fulfilled his obligation.
ג הָעֵצִים הַיּוֹצְאִים מֵאַרְבַּע רָאשֵׁי הַמִּטָּה אָסוּר לִפְרֹס עֲלֵיהֶן סָדִין וְלִישַׁן תַּחְתָּיו, אֲפִלּוּ אִם אֵינָם גְּבוֹהִים עֲשָׂרָה; אֲבָל אִם אֶחָד יוֹצֵא בְּאֶמְצַע הַמִּטָּה בְּרֹאשָׁהּ, וְהַשֵּׁנִי בְּמַרְגְּלוֹתֶיהָ כְּנֶגְדּוֹ, וְנוֹתְנִים כְּלוּנְסוֹת (פֵּרוּשׁ עֵצִים אֲרֻכִּים כְּעֵין קָנֶה שֶׁל רֹמַח) מִזֶּה לָזֶה, מֻתָּר לִפְרֹס סָדִין עָלָיו וְלִישַׁן תַּחְתָּיו, מִשּׁוּם דְּאֵין לָהּ גַּג רָחָב טֶפַח לְמַעְלָה; וְהוּא שֶׁלֹּא יִהְיוּ גְּבוֹהִים עֲשָׂרָה טְפָחִים. וְיֵשׁ מַכְשִׁירִין אֲפִלּוּ בִּגְבוֹהִים עֲשָׂרָה טְפָחִים.
3 Regarding the polls which come out of the four bedposts, it is forbidden to spread out a sheet over them and to sleep under them, even if they are not higher than ten (tefachim). However, if one of them exits in the middle of the bed at the head, and the second from the middle of the foot of the bed (See Sukkah 10a) and a sharp incline is made from this side and that side, it is permitted to spread out a sheet over it to sleep under it because it has no roof the width of a handbreath above it. This is so as long as it is not higher than ten tefachim. There are those who declare this valid even if it is greater than ten tefachim.
ד פֵּרַס סָדִין תַּחַת הַסְכָךְ לְנוֹי, אִם הוּא בְּתוֹךְ אַרְבָּעָה טְפָחִים לַגַּג, כְּשֵׁרָה; וְאִם הוּא רָחוֹק ד' טְפָחִים מִן הַגַּג, פְּסוּלָה; וְאִם אֵינוֹ לְנוֹי, אַף עַל פִּי שֶׁהוּא בְּתוֹךְ אַרְבָּעָה טְפָחִים, פְּסוּלָה וְיֵשׁ לִזָּהֵר שֶׁלֹּא לִתְלוֹת שׁוּם נוֹי סֻכָּה רַק בְּפָחוֹת מִד' לַסֻּכָּה (מַהֲרִי"ל).
4 One may hang sheets (or fabric) under the s'chach for ornamentation; if it is under four tefachim from the roof, it is valid. If it is farther than four tefachim from the roof, it is invalid. And if it is not for ornamentation, even though it is within four tefachim, it is invalid. (and there are those who take precautions not to hang decorations for the sukkah unless it is less than four tefachim) (Maharil)