/    Sign up×
Community /Pin to ProfileBookmark

Spacing in HTML and CSS

Hi There all Web Developers ,
I want text spacing from right side and left for example
I am creating a website and the navigation bar is like the below one
{ 1st bar } Best Friends Home , All , Collections , Types , (I want this navigation bar to be like the second bar )

{2nd bar} Best Friends (Some Space ) Home , All , Collections , Types (I want the 1st bar to be like this bar )

How can I do this……
please advice me 🙁

Thank you

to post a comment
CSSHTMLJavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumMay 20.2021 — Not shure if I understand you correctly but you can achieve this by combining `display: flex;</C> and <C>margin: auto;</C>:
<CODE>
`<i>
</i>&lt;!doctype html&gt;
&lt;html&gt;

&lt;head&gt;
&lt;title&gt;Nav Flex Margin&lt;/title&gt;

&lt;style&gt;
nav {
display: flex;
}

nav a:first-child {
margin-right: auto;
}
&lt;/style&gt;

&lt;/head&gt;

&lt;body&gt;
&lt;nav&gt;
&lt;a href="index.html"&gt;Home&lt;/a&gt;
&lt;a href="all.html"&gt;All&lt;/a&gt;
&lt;a href="collections.html"&gt;Collections&lt;/a&gt;
&lt;a href="types.html"&gt;Type&lt;/a&gt;
&lt;/nav&gt;
&lt;/body&gt;

&lt;/html&gt;<i>
</i>
``
Reference:

https://stackoverflow.com/questions/32551291/in-css-flexbox-why-are-there-no-justify-items-and-justify-self-properties/33856609#33856609
Copy linkTweet thisAlerts:
@pinky093May 20.2021 — To create extra spaces before, after, or in-between your text, use the &nbsp; (non-breaking space) extended HTML character. For example, with "extra space" we have the following code in our HTML. If you are using a WYSIWYG editor to enter the code above, you must be in the HTML tab or editing the HTML code.
Copy linkTweet thisAlerts:
@thietkewebchuanseonxMay 21.2021 — display: flex; https://www.thietkewebchuanseo.com/
×

Success!

Help @FionaObed spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.10,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...