The problem is that your CSS has something that formats this line based on the tag <a>
of HTML Link about CSS Nested
Example:
.Topo{}
.Topo a { aqui está o codigo que alinha e deixa branco}
So when you put it without the <a href
it was left without formatting. (it was not even called the nested css)
3 suggestions:
1. Disable the CSS for <A>
and switch to something custom
Ex:
.Topo a {}
you will replace with:
.MinhaClass{ mesmo código do de cima}
and you’ll call it so:
@Html.ActionLink(linkText: "Bem Vindo(a) " + User.Identity.GetUserName() + "!", actionName: "Index", controllerName: "RelatorioTagModels1", new with {.class = "MinhaClass" })
*NOTE: For you to find which class use the 'inspect' of your browser, it will show which css is.
2. Leave with <a>
but disable the click
Create the following css:
.disabled {
pointer-events: none;
cursor: default;
}
Just call that disable:
@Html.Actionlink(linkText: "Welcome(a) " + User.Identity.Getusername() + "!" , actionName: "Index", controllerName: "Reportariotagmodels1", new with {.class = "disabled" })
3. Create a style that corrects the label
something like:
.LabelNome{
position: relative;
top: 20px;
color: white;
}
and then you call this Labelname equal to the examples above
new with {.class = "LabelNome"
NOTE: It may be necessary to change the value 20px
Good evening my dear, this training can be done in CSS?
– An. Jorge
@Anselmo yes, I’m working with CSS, but I’ve tried to find this configuration of
ActionLink
to switch to theLabel
but without success– Thomas Erich Pimentel
I may be wrong but surely you must have a class or ID that formats the action.link, searches and changes to . label
– An. Jorge
By default mvc uses bootstrap. In boostrap css it should have something like: navbar > a and then the effect of keeping the position there in the middle... When you change to label it loses. Inspect the element when you have the link and check which class is active in css, and create a class for you using the label.
– Thiago Araújo
@Thomaserichpimentel inspects the html page generated by
ActionLink
and note which css classes are included in the element, then see the method documentation.Label()
how to pass an additional css class to be included in the element and put the previously noted classes in Actionlink.– Paulo Roberto Rosa