hello i have this in vuejs
<ul class="new-list">
<div v-for="cat in catss">
<div>
<a :href="link(cat)">
<li class="single-new">
<p class="title">{{cat.title}}</p>
</li>
</a>
</div>
</div>
</ul>
and i have this style
.single-new {
text-align:center;
width:100%;
border-bottom: 1px dotted black;
}
.single-new:last-child {
border:none;
}
but .sing-new:last-child overrid all items and remove border of all
how can i fix this
:last-child always confused, MDN explains it
The :last-child CSS pseudo-class represents the last element among a group of sibling elements.
In your example, what you want is the border of the last item in the list is none.
So, you should do this
.new-list > div:last-child .single-new {
border: none;
}
Every li you have is a last-child of an a tag.
try i like this
<ul class="new-list">
<div v-for="cat in catss" class="single-new">
<div>
<a :href="link(cat)">
<li>
<p class="title">{{cat.title}}</p>
</li>
</a>
</div>
</div>
</ul>
.single-new li {
text-align:center;
width:100%;
border-bottom: 1px dotted black;
}
.single-new:last-child li {
border:none;
}
You should remove all the div, a before the li. directly under an ul are supposed to be li.
You also should not put p (block) inside an a (inline). Use span instead.
Here is a link about the inline/block nature of html elements: Link
I guessed this is what you want
<ul class="new-list">
<div v-for="cat in catss" class="cat">
<div>
<a :href="link(cat)">
<li class="single-new">
<p class="title">{{cat.title}}</p>
</li>
</a>
</div>
</div>
</ul>
CSS
.cat {
.single-new {
text-align:center;
width:100%;
border-bottom: 1px dotted black;
}
}
.cat:last-child {
.single-new {
border:none;
}
}
Related
This question already has an answer here:
Why doesn't nth-of-type/nth-child work on nested elements?
(1 answer)
Closed 3 years ago.
I've been trying to remove the last tab's border-right property... but both the nth-child property or the last-child property isn't working...
plus when i use nth-child(1) it selects all the children and doesn't work for other values
<!-- HTML Markup -->
<ul>
<a href="#">
<li>Solutions</li>
</a>
<a href="#">
<li>Industries</li>
</a>
<a href="#">
<li>Resources</li>
</a>
<a href="#">
<li>Partners</li>
</a>
<a href="#">
<li>About</li>
</a>
<a href="#" class="button">
<li>Enterprise</li>
</a>
</ul>
/* CSS Code */
ul:after{
content: "";
display: block;
clear: both;
}
li {
float: left;
padding: 10px 15px;
/* border-right: 1px solid #a5a5a5; */
color: #1F222B;
}
li {
border-right: 1px solid #ff0000;
}
li:nth-of-type(1) {
border-right: 1px solid #00b2ff;
}
li:hover {
border-right: 1px solid #F3EFF2;
background: #1F222B;
color: #F3EFF2;
}
Kindly help with the solution and the cause?
And is it possible to achieve the solution with 'li' tags inside the 'a' tag
but with the floating 'li' tags?
You can add this CSS to remove the border from the last tab
a:last-child li {
border-right: none;
}
I am trying to make div element visible on focus but it is not working. If i change focus to hover it works
JSFIDDLE https://jsfiddle.net/9bo81jyy/8/
HTML
<div class="test">
<nav class="nav">
<ul class="navtabs">
<li>
<a href="showMe/1">
<div class= "inside">
<div tabindex="0" class="delete">
<button tabindex="-1" class="fa-times-circle"> </button>
</div>
</div>
</a>
</li>
</ul>
</nav>
</div>
CSS
.nav > ul.navtabs > li > a > div:focus .delete{
display: inline !important;
}
.delete{
display: none;
}
only a tag ll be focousable so use below code it'll work...i have updated the jsfiddle
.nav > ul.navtabs > li > a:focus .delete{
border: 1px solid red;
display: inline;
}
This <div tabindex="0" class="delete"> is not available in the DOM because of this CSS:
.delete{
display: none;
}
So that <div> can never be clicked on and can never receive focus.
Instead try focus on the <a> tag:
ul.navtabs a:focus .delete{
display: inline !important;
}
And remove the tabindex="0" on the <div>.
I'm trying to achieve the following :
I have image and I need border 1px black and 1px white on the img to achieve some effects . And on hover 3px border that on click become active class and change the hover to fixed border of 3px.
What is the best way to that ?
I tried to do that with padding 3px on the a link
And gave the following :
a {
float:left;
background-color:white;
padding:3px;
}
and
img {
max-width:100%;
float:left;
}
The problem is that the border is not equal and little bit move the img.
Also When I hover all the UI I need opacity 0.5 and it's make problem with the a
So I looking for the best solution for 3 borders with hover and active/non active without affecting the img
my code is :
<ul>
<li>
<div>
<a class="active">
<img>
</a>
</div>
</li>
<li>
<div>
<a>
<img>
</a>
</div>
</li>
</ul>
Not sure if this is what you had in mind, but I hope that the output below can help you get started.
The main trick here is to put your <img> inside 3 divs:
the innermost div is your white border
the middle div is your black border
the outermost div is a transparent 1px border
The last one is required so that the image doesn't move--since the border is already there and will not have to be generated when you hover.
So when you hover: the outer div becomes white, the middle div (previously black) becomes white, and the last div is, well, still white. Voila! You have your "3px solid white" border on hover.
in order to toggle an active class that will stick, then you will need javascript. In this case, I just went ahead and used JQuery.
last note: since I eliminated your <a> tag, I just put a cursor:pointer rule on your outermost div so that it will still look like you are hovering on a link. You can just place whatever is your link action in your javascript onclick rule.
Hope this helps!
$('.outer').on('click',function(){
$('.active').removeClass('active');
$(this).addClass('active');
});
body {
background:gray;
}
li {
margin-top:15px;
}
li * {
transition:all ease 0.3s;
}
li:hover {
cursor:pointer;
}
.outer {
border:1px solid transparent;
}
.outer:hover,.outer:hover > .black-border {
border:1px solid white;
}
.outer:hover img {
opacity:0.5;
}
.active {
border:1px solid white;
}
.active > .black-border {
border:1px solid white;
}
img {
max-width:100%;
padding:0;
margin:0;
vertical-align:top;
background-size:cover;
}
.black-border {
border:1px solid black;
}
.white-border {
border:1px solid white;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul>
<li>
<div>
<div class="outer">
<div class="black-border">
<div class="white-border">
<img src="https://cdn.pixabay.com/photo/2014/03/29/09/17/cat-300572_960_720.jpg">
</div>
</div>
</div>
</div>
</li>
<li>
<div>
<div class="outer">
<div class="black-border">
<div class="white-border">
<img src="https://www.petfinder.com/wp-content/uploads/2012/11/155293403-cat-adoption-checklist-632x475-e1354290788940.jpg">
</div>
</div>
</div>
</div>
</li>
</ul>
Below is my code:
#sam_ul li {
height: 41px;
border-bottom: 1pt solid #DEDEDE;
background-color: #F8F8F8;
}
#sam_ul li {
list-style-type: none;
}
#u_l_add:before {
content: '\0FBF';
}
<ul id="sam_ul" style="margin:0px;">
<li>
<a href="#">
<span id="u_l_add" style="font-size:36px;line-height:20px;"></span>
<div style="width:130px;position:relative;top:-20px;left:40px;">Add</div>
</a>
</li>
<li>
<a href="#">
<span id="u_l_sear" style="font-size:36px;line-height:20px;"></span>
<div style="width:130px;position:relative;top:-20px;left:40px;">Search Artifact</div>
</a>
</li>
</ul>
The content pseudo element is displayed differently in both IE and mozilla. By different I mean in IE it is displaying correctly while in mozilla it is adding some extra padding and displaying the content.
check the difference between the first li element and the second li element.
Can anyone help me with this?
Add padding:0 to unordered list
#sam_ul{
padding:0
}
#sam_ul li {
height: 41px;
border-bottom: 1pt solid #DEDEDE;
background-color: #F8F8F8;
list-style-type: none;
}
#u_l_add:before {
content: '\0FBF'; }
#u_l_sear:before {
content: '\0FBF'; }
<body>
<ul id="sam_ul" style="margin:0px;">
<li>
<a href="#">
<span id="u_l_add" style="font-size:36px;line-height:20px;"></span>
<div style="width:130px;position:relative;top:-20px;left:40px;">Add</div>
</a>
</li>
<li>
<a href="#">
<span id="u_l_sear" style="font-size:36px;line-height:20px;"></span>
<div style="width:130px;position:relative;top:-20px;left:40px;">Search Artifact</div>
</a>
</li>
</ul>
</body>
Try to normalize everything. HTML and body has default margin and padding for every browser that could ruin your design. Almost all block elements has that.
Try:
html,body{
margin: 0;
padding:0;
}
Or download and add normalize.css
Well, I coded this page, but I got stuck at why does the third column is pushing down my text (or other elements). It uses the same style from the first box, but while the first box is ok, the third one is pushing the elements down by some pixels.
Like this:
HTML
<div id="contentWrapper">
<div id="sideBar">
<div class="sidebarBox"></div>
<div class="sidebarContent">
<h4>
Índice
</h4>
<ul class="tree">
<li>
Sinopse
</li>
<li>
Tropas
</li>
<li>
Geladeira
<ul>
<li>
Lógica
</li>
<li>
Gênio
</li>
<li class="last">
Horror
</li>
</ul>
</li>
<li>
Notas
</li>
<li>
Mídia
</li>
<li class="last">
Referências
</li>
</ul>
</div>
</div>
<div id="mainBody"></div>
<div id="infoBar">
<div class="sidebarBox"></div>3º Column
</div>
</div>
CSS
* {
margin:0;
padding:0;
font:normal normal 14px/20px Helvetica,Arial,sans-serif
}
h4 {
font-size:14px;
font-weight:700;
text-transform:uppercase;
padding-top:10px;
border-bottom:2px solid #2a558c;
margin-bottom:10px
}
#contentWrapper {
display:table;
border-spacing:0;
width:100%;
height:500px
}
#contentWrapper > div {
display:table-cell
}
#sideBar {
background-color:#E4E5DD;
width:200px
}
#mainBody {
background-color:#EEEEE6
}
#infoBar {
background-color:#e4e5dd;
width:200px
}
#footer {
background-color:#323540;
height:50px
}
.sidebarBox {
background-color:#323540;
height:30px;
width:100%
}
.sidebarContent {
padding:15px
}
I messed a lot with the Firebug and even tried to open it in IE and Chrome, with same results. Both columns use the same CSS, and this difference is freaking me out. I thought about "fixing" it with some negative margins, but I want to understand the problem first, insted of "workahacking" away.
Thanks a lot in advance!
Add vertical-align: top to #contentWrapper > div. Currently it is baseline.
Have a fiddle!
CSS
#contentWrapper > div {
display: table-cell;
vertical-align: top;
}
Without vertical-align: top, the div is basing its vertical alignment on .sidebarContent which has 15px of padding. This is resulting in the 15px gap.
Change the following and it should fix your problem. I've found that when using display:table-cell it always mis-aligns the last cell unless I specifically give it a vertical alignment
#contentWrapper > div {
display: table-cell;
vertical-align:top;
}
Example
Add display:inline-block to this class:
.sidebarBox {
background-color: #323540;
height: 30px;
width: 100%;
display: inline-block;/*Add this*/
}
fiddle
.sidebarBox {
float:right;
}
will work.