The following is from Purdue OWL
Poem in a book:
Author of Poem's Last Name, First Name. "Title of Poem." Title of Book: Subtitle if Any, edited by Editor's First Name Last Name, Edition if given and is not first, Publisher Name often shortened, Year of Publication, pp. Page Numbers of the Poem.
Burns, Robert. "Red, Red Rose." 100 Best-Loved Poems, edited by Philip Smith, Dover, 1995, p. 26.
If the specific literary work is part of the author's collection (all of the works have the same author), then there will be no editor to reference:
Whitman, Walt. "I Sing the Body Electric." Selected Poems, Dover, 1991, pp. 12-19.
In-text Citation: (Whitman, pp 12-19).
*For poems, cite the line(s) of the poem, rather than the page number in the in-text citation.*
The following is from Purdue OWL
If the poem is from a website, cite it as you would a page on a website.
Author's Last Name, First Name. "Title of Poem." Title of Website, Name of Organization Affiliated with the Website, Date of copyright or date last modified/updated, URL. Accessed Day Month Year site was visited.
Keats, John. "On the Grasshopper and Cricket." Poetry Foundation, Poetry Foundation, 2020, https://www.poetryfoundation.org/poems/53210/on-the-grasshopper-and-cricket. Accessed 24 March 2020.
In-text Citation: (Keats, lines 5-8).
*For poems, cite the line(s) of the poem, rather than the page number in the in-text citation.*