[英]How to change css class according to the name attribute of a parent
I need your help for a CSS issue.我需要你的 CSS 问题帮助。 I must change a class on only one element which is created with this : https://angular-ui.github.io/bootstrap/#/dropdown
我必须只在一个用这个创建的元素上更改一个类: https : //angular-ui.github.io/bootstrap/#/dropdown
The element is encapsulated in the generated code so I can't give it an id or anything else.元素被封装在生成的代码中,所以我不能给它一个 id 或其他任何东西。 The only attribute that I can access is in a div (name="OrganizationTypes") which contains the element I need to change.
我可以访问的唯一属性是包含我需要更改的元素的 div(名称 =“OrganizationTypes”)。
The generated code looks like this:生成的代码如下所示:
<div class="ui-select-container ui-select-multiple ui-select-bootstrap dropdown ng-pristine ng-valid ng-isolate-scope ng-not-empty open ng-touched"
style="width: 100%; display: inline-block;" tabindex="0" uib-dropdown="" auto-close="outsideClick"
name="OrganizationTypes" items="vm.availableOrganizationTypes" ng-model="vm.data.organizationTypes" type="text">
<ul class="ui-select-match form-control dropdown-toggle" uib-dropdown-toggle="" style="margin-bottom:2px;height:auto!important;min-height:31px;" aria-haspopup="true" aria-expanded="true">
<!-- ngRepeat: selected in vm.selectedLabel track by selected.path -->
</ul>
<!-- I need to modify dropdown-menu for this ul -->
<ul class="ui-select-choices ui-select-choices-content ui-select-dropdown dropdown-menu" style="width:inherit; overflow:auto; max-height:20em" ng-click="$event.stopPropagation()">
<li class="ui-select-choices-group">
<div>
...
</div>
</li>
</ul>
</div>
The boostrap class is defines like this : boostrap 类定义如下:
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
and I need to change the position to relative.我需要将位置更改为相对位置。
How can I achieve this this ?我怎样才能做到这一点? I need to redefine a new dropdown-menu but I don't know how the selector.
我需要重新定义一个新的下拉菜单,但我不知道选择器如何。 I'm absolutely incompetent in CSS :(
我完全不擅长 CSS :(
Thanks in advance !提前致谢 !
Maybe I'm misunderstanding your question, but I think you are looking for the [attribute=value]
selector.也许我误解了您的问题,但我认为您正在寻找
[attribute=value]
选择器。
Here you can find examples CSS [attribute=value] Selector在这里您可以找到示例CSS [attribute=value] 选择器
In your case, I think you should build a selector like this:在你的情况下,我认为你应该构建一个这样的选择器:
div[name=OrganizationTypes] .dropdown-menu {
position: relative;
}
Tell us if it is what you are looking for =)告诉我们这是否是您要找的东西 =)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.