Need solution for Hover Issue - css

I have an Product listing Page designed using ul li grid layout.The width of li is 171*367px.When the user hovers over the each li i need to 10px margin to all the sides of li and a box shadow as well.While adding the margin of 10px to each side the height of li increases and as a result the li while it expands pushes its adjacent elements.
I would need to achieve this without affecting the layout
Is there any way to accomplish this

Instead of margin use translate(x,y) property here x and y refers to coordinates of respective axis.

Related

How do I remove this margin in CSS without affecting the rest of the site?

I have a map on my web page at http://fattyres-co-uk.stackstaging.com/routes/lake-district/borrowdale-bash/.
It contains a copyright attribution in the bottom right corner which is a unordered list.
I want to remove the left and bottom margin from it but, if I change the margin for ul in my style sheet, it affects every ul on my site and I don't want that.
How do I remove the margin only for for this attribution text?
You can use the class of parent element whose child is the ul element.
.ol-uncollapsible ul {
margin: 0;
}

The height of an horizontal ul is set to zero. why?

I want to show the content of my Mega-menu also within the page. I duplicated the CSS styles but it seems that I still miss a rule because the border of the UL with id="wrongBorder_because_of_no_Height" does not show around the whole UL, probably because the UL height is 0
sample page - http://www.teddicom.com/test_07_ul_border_stack_overflow.htm
[compare the border of the floating menu of family 2, and the border of the UL in the page]
What is setting the height of horizontal ul to zero?
How can I show the border properly?
Add overflow:hidden or overflow:auto to your class
#wrongBorder_because_of_no_Height
{
overflow:hidden;
}
The reason why this works is because by setting the overflow property to a value which is not visible - this triggers a block formatting context.
Check out this post for a full explanation.
Add this to your CSS:
.menuInPage ul
{
height: 200px;
}
You are floating the li elements left. Parent elements, the ul, are never to expand to contain floated children.
Haven't checked to see if this is what you want but either remove the float or try overflow:auto.

Horizontal navigation with float and absolute positioning

I have a horizontal navbar in the form of an unordered list, where the list items are all floated left, and the list has overflow:hidden; for consistency. I want the "active" tab to be taller, without changing the layout of the list element.
The navbar is 60px tall with each list item 50px tall, and I want the active tab to be 55px. The question is, how do I get the list items to "stick" to the bottom of the navbar, without changing their horizontal positioning?
Things I've tried: (this list will grow)
ul#nav{position:relative;} and ul#nav li{position:absolute;bottom:0;} stacks all elements on top of each other; I refuse to hard-code each tab's position
ul#nav li.active {position:relative;bottom:/* difference in heights */;} leaves the block where the tab originally was empty, effectively acting as an unwanted margin
The solution was simple (and I'd already been using it for styling of list items). Rather than style the list items themselves, I styled their contents, which are each anchor tags. So the default anchor tag has
height:50px;margin-top:10px;
while the .active tag is styled
height:55px;margin-top:5px;
A less difficult problem than I imagined.
example with vertical-align : http://dabblet.com/gist/5333194
ul {
line-height:60px;
}
li {
display:inline-block;
vertical-align:bottom;
height:50px;
}
li:hover {
height:55px;
}

Border on bottom of UL with floating LI's without setting a height

I setup a jsFiddle to show what I'm doing:
http://jsfiddle.net/UfzCS/
Basically the border I set (needs to go all the way across) on the UL is showing up over (instead of under) the LI's because the LI's are floated left. Is there any workaround for this? I know I can set a height, but I may make the text a variable size so the height may dynamically change.
Your LI are floated, so the UL does not know where to wrap them.
An easy way to fix this is to make the UL float: left or add a overflow: hidden to it.

Positioning nested ul

I have a nested ul (menu) and want to position the nested menu directly beneath the containing menu, starting on the same horizontal position as the outer menu.
See Example
In this example the nested menu is positioned too far to the left and a little too high (it should start vertically where the containing menu ends).
I might use left: 0px; as showed here to fix the horizontal position, but that still doesn't fix the vertical position.
You can use top:40px; to fix the vertical position
Like here: http://jsfiddle.net/zdkb5/2/
I fixed it with:
margin-top:10px; to the #menu > ul > li > ul class
Demo
The height of the outer container is irrelevant.

Resources