Module:NavboxMobile: Difference between revisions

No edit summary
No edit summary
 
Line 227: Line 227:
         :cssText(args.basestyle)
         :cssText(args.basestyle)
         :cssText(args.titlestyle)
         :cssText(args.titlestyle)
        :css('position', 'relative')  -- Ensure relative positioning for absolute children


     -- Add the navbar, floated right
    -- Add the title content, centered across the full width
    titleCell
        :tag('div')
            :css('margin', '0 auto')
            :css('text-align', 'center')
            :wikitext(addNewline(args.title))
 
     -- Add the navbar, positioned absolutely in the top-right corner
     if has_navbar() then
     if has_navbar() then
         titleCell
         titleCell
             :tag('div')
             :tag('div')
                 :addClass('navboxMobile-navbar')
                 :addClass('navboxMobile-navbar')
                 :css('float', 'right')
                 :css('position', 'absolute')
                 :css('margin-left', '0.5em')
                :css('top', '0')
                :css('right', '0')
                 :css('padding', '0.2em') -- Optional: Adjust padding for alignment
                 :wikitext(navbar{
                 :wikitext(navbar{
                     args.name,
                     args.name,
Line 241: Line 251:
                 })
                 })
     end
     end
    -- Add the title content, centered
    titleCell
        :tag('div')
            :css('text-align', 'center')
            :wikitext(addNewline(args.title))
end
end