使用TailwindCSS将标志放在左上角,菜单放在右上角。

huangapple go评论52阅读模式
英文:

Using TailwindCSS to put logo in top left and menu in top right

问题

这是您提供的代码片段,以下是翻译好的部分:

<div className="isolate">
    <div className="px-6 pt-6 lg:px-8">
        <div>
            <nav
                className="flex h-9 items-center justify-between"
                aria-label="全局"
            >
                <div
                    className="flex lg:min-w-0 lg:flex-1"
                    aria-label="全局"
                >
                    <a href="/" className="-m-1.5 p-1.5">
                        <span className="sr-only">公司名称</span>
                        <img
                            className="h-8"
                            src="/this-company-logo.png"
                            alt="公司名称"
                        />
                    </a>
					<ul>
						<li><a href="">首页</a></li>
						<li><a href="">联系</a></li>
					</ul>
                </div>
            </nav>
        </div>
    </div>
</div>

希望这有助于您理解代码的结构。如果您需要进一步的帮助,请随时提问。

英文:

I have managed to write some Tailwind CSS to put a logo in the top left hand corner of the screen, but now I cant seem to get a menu to render in the top right, this is what I have. Nothing I try seems to work. It just renders right next to the logo image

&lt;div className=&quot;isolate&quot;&gt;
    &lt;div className=&quot;px-6 pt-6 lg:px-8&quot;&gt;
        &lt;div&gt;
            &lt;nav
                className=&quot;flex h-9 items-center justify-between&quot;
                aria-label=&quot;Global&quot;
            &gt;
                &lt;div
                    className=&quot;flex lg:min-w-0 lg:flex-1&quot;
                    aria-label=&quot;Global&quot;
                &gt;
                    &lt;a href=&quot;/&quot; className=&quot;-m-1.5 p-1.5&quot;&gt;
                        &lt;span className=&quot;sr-only&quot;&gt;This Company Name&lt;/span&gt;
                        &lt;img
                            className=&quot;h-8&quot;
                            src=&quot;/this-company-logo.png&quot;
                            alt=&quot;This Company Name&quot;
                        /&gt;
                    &lt;/a&gt;
					&lt;ul&gt;
						&lt;li&gt;&lt;a href=&quot;&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
						&lt;li&gt;&lt;a href=&quot;&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
					&lt;/ul&gt;
                &lt;/div&gt;
            &lt;/nav&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;

答案1

得分: 1

你需要删除这个标签:

...
&lt;div className=&quot;flex lg:min-w-0 lg:flex-1&quot; aria-label=&quot;Global&quot;&gt;
  ...
&lt;/div&gt;
...
英文:

You have to remove this tag:

...
&lt;div className=&quot;flex lg:min-w-0 lg:flex-1&quot; aria-label=&quot;Global&quot;&gt;
  ...
&lt;/div&gt;
...

huangapple
  • 本文由 发表于 2023年2月19日 13:49:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75498251.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定