Question How to position right?

raysefo

Well-known member
Joined
Feb 22, 2019
Messages
155
Programming Experience
10+
Hi,

I have an asp.net core web application. I would like to position @User.Identity.Name at the right of the navigation. I tried to add float:right in the bootstrap.css but nothing changed. Can anyone show me how to position?

Here is the layout.cshtml:
C#:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - GameMonitor</title>

    <environment include="Development">
        <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
        <link rel="stylesheet" href="~/css/site.css" />
    </environment>
    <environment exclude="Development">
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
              asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
              asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
        <link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
    </environment>
</head>
<body>
    <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">Game Monitor</a>
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li><a asp-area="" asp-controller="GameBanks" asp-action="ImportExcel">Upload Games</a></li>
                    <li><a>@User.Identity.Name</a></li>
                  
                </ul>
            </div>
...
 

Sheepings

Senior Programmer
Joined
Sep 5, 2018
Messages
345
Location
UK
Programming Experience
10+
Post the respective .min.css files. If they wont fit on the forum, pastebin them and put their links here.

Also provide the html that you attempted to use.
 

raysefo

Well-known member
Joined
Feb 22, 2019
Messages
155
Programming Experience
10+
This solved my problem:
C#:
<ul class="nav navbar-nav navbar-right">
   <li><a>Hello, @User.Identity.Name</a></li>
</ul>
 

Sheepings

Senior Programmer
Joined
Sep 5, 2018
Messages
345
Location
UK
Programming Experience
10+
That doesn't show how you fixed it, or what css you used. Whatever you did, you should check for compliance across all browsers, as there are many ways to position and align html objects. As a aside, What works in one browser, doesn't always work in others. So be sure your css rules work explicitly across all browsers, and I'm talking in general, not aligning.
 

raysefo

Well-known member
Joined
Feb 22, 2019
Messages
155
Programming Experience
10+
Hopefully, IE disappear someday soon :)
 

Sheepings

Senior Programmer
Joined
Sep 5, 2018
Messages
345
Location
UK
Programming Experience
10+
I don't think that's likely to happen any day soon.

There is also safari for mac, chrome by google, and opera, Mozilla as well as ie. You've a range of browsers to factor compliance for.
 

Skydiver

Well-known member
Joined
Apr 6, 2019
Messages
365
Location
Virginia Beach, VA
Programming Experience
10+
Instead of hacking the Bootstrap CSS, use it to your advantage. See this SO answer:
 

Skydiver

Well-known member
Joined
Apr 6, 2019
Messages
365
Location
Virginia Beach, VA
Programming Experience
10+
Hopefully, IE disappear someday soon :)
I don't think that's likely to happen any day soon.
Yes, even with Microsoft begging that people ditch IE, many companies have far too much investing in apps that only work in IE because they had drunk Microsoft's Kool Aid regaining ActiveX, SilverLight, etc, and/or that Flash will be around forever.

(For that matter, the company that I work for has invested a lot of time and money making it's external facing website prefer Chrome over IE, but unfortunately, due to a bug, the only way to download your Explanation of Benefits is by using IE instead of Chrome. Clicking on the Download button in Chrome does nothing for some reason.)
 

Sheepings

Senior Programmer
Joined
Sep 5, 2018
Messages
345
Location
UK
Programming Experience
10+
As you may know, I built a project a few years ago which is solely dependent on the ie wrapper (or formally known as the "web browser control"), and It would take me years to switch and implement a new browser control which almost all of them don't offer the same working functionality as the ie wrapper does. A project solely dependent on ie features, and is currently irreplaceable by today's "alternatives", such as chromium cefsharp etc. I've tested most of them...

I would also hate to accept all the registry reading and emulation keys I had to write too to achieve certain functionality was all in vain. There are still a lot of corporate companies out there who feel the same as me and would prefer to see ie maintained. Although It is a default feature of the windows os, I wouldn't choose it as preference as a personal web browser and I'd be quick to replace it with something like Opera, but with that said, there are still a minority who do use it and they still need to be accommodated for when writing css driven websites. Until its permanently dissolved and abandoned with notice by its creators, there is likely going to be some support offered for it.

Maybe, just maybe with Microsoft introducing Linux kernels in windows 10; down the line, this could open up a few new avenues for allowing other Linux based applications to run inside windows. I am sure there are many Linux users who prefer using Linux based web browsers, just like Midori, and perhaps down the pipeline, this might be something planned for the future by Microsoft themselves?

As I like to say... in programming; nothing is impossible, and everything is conceivable from the programmers perspective. With Microsoft showing interest in Linux kernels, and Microsoft planning to ditch ie. This is something that has been on the cards for a long time, but with so much corporate investment from companies who still use ie; both in-house as a browser as well as those who still use it in development (like me with the web browser control), I can't see ie disappearing anytime soon. Certainly not without a replacement wordy of a painless switch. With some companies like Valve corp, who only stopped using the ie wrapper a few years ago in their game client software, similar scenarios make it an unlikely fact that it's not going anywhere for a while.

Some reads on the new kernel merger for anyone who might be interested in further reading :
Bad News! Windows 10 Will Soon Have a Real Linux Kernel - It's FOSS
Microsoft's built-in Linux kernel for Windows 10 is ready for testing
Windows 10’s Linux Kernel Is Now Available - the first link you've already seen @Skydiver.

The last company I worked for only used ie, and no alternatives where allowed to be installed on the systems. The joys of working for a company devoted to Microsoft technologies. :)
Clicking on the Download button in Chrome does nothing for some reason
I'm surprised you didn't blame a java developer for that. 😝😂
 

Skydiver

Well-known member
Joined
Apr 6, 2019
Messages
365
Location
Virginia Beach, VA
Programming Experience
10+
Nah, for the download issue, it was somebody having drunk the Kool Aid and not bothering to test the other browsers.
 
Top Bottom