O Aprendiz
O Aprendiz

Reputation: 55

Customize an item within the CSS for a specific view

I have this view in MVC

View

@model XXX
@{

}

<link href="/eTeste/Content/AbaDetailsODM.css" rel="stylesheet" type="text/css" />

<div id="consoleAbaDetalhes"></div>

<div id="campos_detail">
    @using (Ajax.BeginForm(
        "xxxx",
        "xxxx",
        new AjaxOptions
        {
            InsertionMode = InsertionMode.Replace,
            UpdateTargetId = "consoleAba",
            HttpMethod = "POST",

        }))
    {
        @Html.Partial("Validation")
        @Html.HiddenFor(i => i.Id)
        @Html.HiddenFor(i => i.IdEmpresa)
        @Html.HiddenFor(i => i.IdModeloVersao)
        [...]

        <div id="campos">
            <div class="CampoRealyOnly">
                @Html.EditorFor(i => i.User)
                <div class="clear"></div>
                @Html.EditorFor(i => i.Gerente)
                <div class="clear"></div>
                <div id="chefesDeProjeto">
                @Html.EditorFor(i => i.Descricao, "TextArea", new { colunas = 30, linhas = 5 })
                </div>

            </div>

            <div class="CampoRealyOnly clear field-middle">

            <h3>@Html.Label(ODMResources.AreaLeader):</h3>
                @Html.TextBoxFor(x => x.ResponsaveisFuncao)
            </div>
            [...] //Vários Campos
        </div>

The system has its own CSS fields. I would like to change some of that CSS only for this View. This portion is generic system.

The CSS works as I would like.
the problem is that it changes all other tabs even though he only referenced in this view.
I believe it is the cascade so that makes it changed at all.

What could I do to separate this being something Generic system?

CSS

.CampoRealyOnly
input[type=text], textarea, select
{
    border: 1px solid #888888;
    left: 298px;
    position: relative;
    top: -29px;
}

Upvotes: 0

Views: 39

Answers (1)

xtrinch
xtrinch

Reputation: 2281

You have to add the class selector on every item like this:

.CampoRealyOnly input[type=text], .CampoRealyOnly textarea, .CampoRealyOnly select
{
    border: 1px solid #888888;
    left: 298px;
    position: relative;
    top: -29px;
}

Upvotes: 1

Related Questions