I have a site consisting of three articles. I have a couple media queries set up for responsive design, but as I resize, it seems the ul and li elements of the article overflow the article (tested on an iphone5). I can hack around this by setting a height on the article to, say 200%, but would like to avoid this if I can. The CSS behind the article and ul:
#about {
background-color: #ebebeb;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#about h1 {
text-align: center;
margin: 0;
padding-top: 3em;
}
#about ul {
display: block;
width: 100%;
margin: 5em auto;
list-style: none;
padding: 0;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
#about ul li {
width: 20%;
float: left;
vertical-align: top;
margin:0 6.6666665%;
font-size: .8em;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
#about ul li img {
display: block;
margin-left: 2em;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
And here is a jsFiddle => http://jsfiddle.net/sKvqF/
It's hard to recreate the effect it's giving without all the necessary code but I'm hoping someone can spot an error in my code somewhere.
I'm not 100% sure, what you are referring to by 'overflow' but if you are floating the list-items, you highly probable want to include a clearfix on your ul, such as:
#about ul:before, #about ul:after { content: ""; display: table; }
#about ul:after { clear: both; }
#about ul { zoom: 1; }
See https://stackoverflow.com/a/6539954/1696030
But be also aware of the high specifity of your CSS selectors, see f.e. http://csswizardry.com/2011/09/when-using-ids-can-be-a-pain-in-the-class/
Related
What should I change in CSS to match logo size to menu. I tried do it myself but I can't do it.
http://marekzurek.com
Thank you so much for your help!
Have you tried the following CSS:
.logo img {
height: 50px;
width: auto;
}
.logo {
padding-top: 15px;
-webkit-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
height: 80px;
}
.menu-bg .logo {
padding-top: 10px;
-webkit-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.menu-bg img {
max-height: 120px;
}
I'm working with a template that uses Font Awesome for social media icons. Since one of the icons I need is not included in Font Awesome I found a CSS trick to overwrite a certain icon by a custom image. This works fine (fa-toggle-on can be replaced with any random icon):
.home i.fa.fa-toggle-on {
content:url(\http://www.url.com/image1.png);
margin-top: 10px;
}
However, when hovering this image I need to show a different PNG (different color). Let's say "image2.png". I've been puzzling with this for an hour or so and can't seem to fix it. Commands like ".home i.fa.fa-toggle-on a:hover" don't seem to do the trick. Any ideas? Everything will be highly appreciated!
The CSS for the "normal" Social Media icons with Font Awesome is as follows:
/**
* SOCIAL ICONS
*/
#social-icons {
padding: 0;
margin: 0;
}
#social-icons li {
display: inline;
float: left;
margin-right: 1px;
line-height: 32px;
}
#social-icons li a {
display: inline-block;
width: 40px;
height: 40px;
text-align: center;
margin: 20px 0 0 0;
-webkit-transition: all 0.25s ease;
-moz-transition: all 0.25s ease;
-o-transition: all 0.25s ease;
transition: all 0.25s ease;
}
#social-icons li a:hover {
height: 80px;
margin-top: 0;
background: #fff;
}
#social-icons li a i:before {
position: relative;
top: 5px;
font-size: 18px;
color: #fff;
-webkit-transition: all 0.25s ease;
-moz-transition: all 0.25s ease;
-o-transition: all 0.25s ease;
transition: all 0.25s ease;
}
#social-icons li a:hover i:before { top: 25px; }
Based on this line in the CSS
#social-icons li a:hover i:before
You need
#social-icons li a:hover i.fa.fa-toggle-on {
content:url(\http://www.url.com/image2.png);
}
I have ben boxing with this issue for ages now.
I have a parent div "wrapper" containing a child div "sidebar-wrapper" consisting of an ul with li in it.
I want "sidebar-wrapper"s height to fit "wrappers" height. My issue is when i set its height to auto goes 0.
My HTML:
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li class="sidebar-brand">
<a href="#">
a lit of these li's
</a>
</li>
</ul>
</div>
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
Whatever Content!!
</div>
</div>
</div>
</div>
My css:
#wrapper {
overflow:auto;
border: 1px solid #000000;
width: 100%;
min-height:400px;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#sidebar-wrapper {
margin-left: -150px;
overflow-y: auto;
background: #000;
height:400px;
float:left;
background-color:#222222;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#page-content-wrapper {
width: 100%;
position: absolute;
padding: 15px;
}
.sidebar-nav li {
text-indent: 20px;
line-height: 40px;
}
.sidebar-nav li a {
display: block;
text-decoration: none;
color: #999999;
}
See this fiddle
The CSS used is as follows
html,body{
height: 100%;
}
#wrapper {
overflow:auto;
border: 1px solid #000000;
width: 100%;
height: 100%;
min-height:400px;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#sidebar-wrapper {
margin-left: -150px;
overflow-y: auto;
background: #000;
height:100%;
float:left;
background-color:#222222;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#page-content-wrapper {
width: 100%;
position: absolute;
padding: 15px;
}
.sidebar-nav li {
text-indent: 20px;
line-height: 40px;
}
.sidebar-nav li a {
display: block;
text-decoration: none;
color: #999999;
}
I've given height:100% for html,body,wrapper and body-content..
Setting height to auto just sets the height equal to the height of the contents of the div..here i think you want the height to be equal to the wrapper..so you'll have to set it to 100%.
and this is how can i see your website after making the specified changes..
Change the sidewrapper height to 100% and give the wrapper a height: see fiddle: See fiddle
#wrapper {
overflow:auto;
border: 1px solid #000000;
width: 100%;
height: auto; /* example height */
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#sidebar-wrapper {
margin-left: -150px;
overflow-y: auto;
background: #000;
height:100%;
float:left;
background-color:#222222;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
#page-content-wrapper {
width: 100%;
position: absolute;
padding: 15px;
}
.sidebar-nav li {
text-indent: 20px;
line-height: 40px;
}
.sidebar-nav li a {
display: block;
text-decoration: none;
color: #999999;
}
Set the parent div's position to relative and children div's to absolute:
#wrapper {
...
...
/**** added css ****/
position:relative;
/*********************/
...
...
}
Edit 1
as you commented, I came to learn that you want the sidebar to available throughout the page regardless the height of the page.
If that is the case then "wrapper" div has nothing to do with.
Just set the position of "sidebar-div" to "fixed" and give proper top and bottom margins according to your page header and footer margins:
and set the top and bottom of child wrapper to 0:
#sidebar-wrapper {
...
...
/**** added css ****/
position:fixed;
top:10px;
bottom:10px;
/*********************/
...
...
}
Here's the updated demo JS fiddle link:
Updated Demo JS Fiddle Link
Hope that helps!
Take a look at this: http://jsfiddle.net/8D4f4/1/
The problem is that the li-element is too high. You can see that the list element got a grey background. You can see the grey under the image.
The question is. Why is the li element higher than the image?
I need the li element to have the same height as the image.
html
<div id="content">
<ul id="references-all" class="references">
<li data-id="online">
<img src="http://s1.directupload.net/images/140627/779m36rh.jpg"
width="324" height="240" class="references-images">
<div class="description">
<img src="http://s14.directupload.net/images/140627/z49aajek.png">
<div>
<p>Lorem Ipsum Lorem</p>
<img src="http://s1.directupload.net/images/140627/g8yce4ta.png"
width="28" height="27" class="description-arrow">
</div>
</div>
</li>
</ul>
</div>
css
#content .references {
margin-bottom: 50px;
max-width: 980px;
width: 100%;
}
#content .references li {
background-color: darkgrey;
float: left;
margin: 1px;
max-width: 404px;
min-width: 225px;
overflow: hidden;
position: relative;
width: 33%;
}
#content .references li:hover > .description{
background-color: #78785a;
height:100px;
}
#content .references li .references-images {
height: auto;
width: 100%;
-webkit-transition: all 0.5s ease-in;
-moz-transition: all 0.5s ease-in;
-ms-transition: all 0.5s ease-in;
-o-transition: all 0.5s ease-in;
transition: all 0.5s ease-in;
}
.description {
bottom: 0;
color: #ffffff;
display: block;
height: 50px;
overflow: hidden;
padding: 7px 0 0 5px;
position: absolute;
-webkit-transition: all 0.5s ease-in;
-moz-transition: all 0.5s ease-in;
-ms-transition: all 0.5s ease-in;
-o-transition: all 0.5s ease-in;
transition: all 0.5s ease-in;
width: 100%;
}
.description p {
color: #ffffff;
display: block;
float: left;
font-size: 0.800em;
margin: 0;
padding-bottom: 15px;
padding-top: 10px;
width: 85%;
-webkit-transition: all 0.5s ease-in;
-moz-transition: all 0.5s ease-in;
-ms-transition: all 0.5s ease-in;
-o-transition: all 0.5s ease-in;
transition: all 0.5s ease-in;
}
.description .description-arrow {
float: left;
margin-top: 10px;
}
li's height is greater than img's, because img's layout is similar to inline-block and it positions img's bottom edge to the text's baseline which is causing spacing to appear for the text descenders. In your case you can just add vertical-align property to the img element to remove spacing below the image :
img { vertical-align:top; }
JSFiddle
set display:block on your <li> and your <img>
#content .references li {
display:block;
}
#content .references li .references-images {
display:block;
}
Fixed Fiddle
I am currently working on my tumblr theme footer size. I changed the paddings of the ".post .footer" so that it would be smaller and came up with:
#wrapper #content .post .footer {
background: {color:Footer} url({image:footer});
{block:IfFooterBorder}
border: {text:Footer Border}px solid {color:Footer Border};
{/block:IfFooterBorder}
font-family: {text:font family secondary};
font-size: 9px;
color: {color:Footer text};
padding:4px 8px;
margin-top:15px;margin-bottom:8px;
line-height:8px; z-index:10;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
transition: all 0.2s linear;
}
#wrapper #content .post .footer .date {
width: 67%;
float: left;
}
#wrapper #content .post .footer .notes {
width: 33%;
float: right;
text-align: right;
}
#wrapper #content .post .footer .notes a, #wrapper #content .post .footer .date a {
color: {color:Footer link};
text-decoration:none;
}
#wrapper #content .post .footer .tags a {
color: {color:Footer link};
{block:ifnotlinkunderline}
text-decoration: none;
{/block:ifnotlinkunderline}
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
transition: all 0.2s linear;
font-size: 10px;
}
So then I tested it and am satisfied with the size. But then i noticed that the second footer (footer for the post tags)'s size is slightly bigger than the first footer (the footer for the time or date and notes).
So then i decided to edit it and add a separate section for the "tags" footer. I placed this in between ".post .footer .notes a,.post .footer .date a" and " .post .footer .tags a":
#wrapper #content .post .footer .tags {
padding:0px 0px;
}
I put in 0px paddings so that the size would be smaller as there are no paddings. But it still did not work so i changed the paddings to:
#wrapper #content .post .footer .tags {
padding:-1px -1px;
}
Then i tested it, but it still did not work. What's going on? The second footer's size is still bigger and the footers are still imbalanced. Am I missing something here?
Okay, tag is an inline element by default, so you need to add display:block; to it so that it can adapt to your custom width and height.
#wrapper #content .post .footer .tags a {
color: #ffdaf4;
text-decoration: none;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
transition: all 0.2s linear;
font-size: 10px;
font-style: italic;
cursor: help;
display: block; //add this line to change the height
line-height: 8px; // add this line to vertical center your text for better looking
}