I have a stylesheet for when #media screen and (max-width:639px)
When it is above 639px, it refers to my default CSS code which is what I want. But there are two elements I want to hide when the screen is below 667px.
In other words, when the screen is between 639px and 667px, I want the default CSS to show with two elements removed from it using .class{display:none}.
I tried min-width:666px, max-width:667px and several other variations but I can't get it to work.
Here's my blog:
Here's my css file: Link
body {
background-color:#CEDEAF;
color:#111530;
font-size:16px;
overflow-y:scroll;
margin:auto;
font-family:'Noto Sans', Arial, sans-serif;
line-height:2;
letter-spacing:1px
}
img, iframe {
border:none;
max-height:100%;
max-width:100%;
display:inline-block;
vertical-align:top;
padding:.75%
}
header {
text-align:center
}
a {
text-decoration:none;
color:#C33125
}
a:hover {
text-decoration:none;
color:#111530
}
h1, footer a {
color:#111530
}
footer a:hover {
color:#C33125
}
a:hover img {
opacity:.8
}
hr {
border:none;
height:1px;
background-color:#ddd
}
header img {
position:relative;
padding:0;
margin:auto;
nopin:nopin
}
.follow {
position:absolute;
top:.5%;
right:0;
margin-right:3%
}
#main {
margin:0 auto;
background-color:#fff;
width:95%
}
#Blog1 {
padding:1%
}
h1 {
margin:0;
font-size:1.3em;
text-transform:uppercase;
text-align:center;
margin-bottom:1%
}
.homelist {
text-align:center;
margin-top:-.75%
}
.homelist img {
width:30%
}
.left img {
float:left;
margin-right:20px
}
.center, .videopost, .breadcrumb, footer {
display:block;
text-align:center
}
.videopost img {
width:1px;
position:absolute
}
ul {
list-style-position:inside
}
.staticpagelist ul, .imagetextlist ul {
margin-left:-40px
}
.staticpagelist ul li, .imagetextlist ul li {
display:inline-block;
text-decoration:none;
padding:1.5%;
text-align:center;
vertical-align:top;
font-size:.8em;
width:30%
}
.staticpagelist ul li {
font-size:.85em;
font-weight:700
}
.sub {
margin:1% auto;
font-weight:700;
text-transform:uppercase;
padding:.75%;
border-top:1px solid #ddd;
border-bottom:1px solid #ddd
}
.hcard, .hcard a {
color:#aaa
}
.hcard, footer {
font-size:.7em;
font-weight:700
}
.breadcrumb {
font-size:.8em
}
.menu {
text-align:center;
font-weight:700;
padding-bottom:.5%
}
.related-posts-widget ul {
height:250px;
overflow:hidden
}
.related-posts-widget ul li {
width:13%
}
footer {
margin:1%
}
#media screen and (max-width:639px) {
h1, .sub {
font-size:.9em
}
header img, .homelist img, iframe {
width:90%
}
#main {
width:98%
}
.mobilesquish img, .staticpagelist ul li {
width:47%
}
.breadcrumb {
margin-bottom:2%
}
.follow, .related-posts-widget, .hcard, .remove {
display:none
}
}
Try this
#media screen and (min-width: 639px) and (max-width: 667px) {
//css here display: none
}
use following code
#media screen and (min-width: 639px) and (max-width: 667px) {
//css here display: none
}
#media screen and (max-width: 639px){
//write Css for screen less than 639px
}
Related
Ok so this may be a very simple/obvious question, so I apologize if its a dumb question but didnt know where else to ask. But when using CSS and media queries for a responsive layout, should I re-use CSS code inside the media queries? For example:
h1 {
font-size:14px;
margin:0;
padding:0;
}
#media (min-width:768px) {
h1 {
font-size:12px;
margin:0;
padding:0;
}
}
Or is this the proper method?
h1 {
font-size:14px;
margin:0;
padding:0;
}
#media (min-width:768px) {
h1 {
font-size:12px;
}
}
And with grouping css properties with regards to breakpoints. Should I group all CSS properties for each breakpoint? Or just do it as needed? For example:
First method
h1 {
font-size:14px;
margin:0;
padding:0;
}
h2 {
font-size:12px;
margin:0;
padding:0;
}
#media (min-width:768px) {
h1 {
font-size:12px;
margin:0;
padding:0;
}
h1 {
font-size:10px;
margin:0;
padding:0;
}
}
//Other CSS properties for this page/site
#page-footer .footer-bot {
background-color:#24262b;
font-family:'PT Sans',sans-serif;
font-weight:400;
text-transform:uppercase;
font-size:10px;
color:#adadad;
letter-spacing:.3px;
line-height:18px;
padding-top:5px;
padding-bottom:5px;
}
#media (min-width:768px) {
#page-footer .footer-bot {
line-height:25px;
padding-top:0;
padding-bottom:0;
}
}
Or in the second method, wait till the end of the CSS script and do all the breakpoint changes at the very end in one group for each breakpoint I want to use?
h1 {
font-size:14px;
margin:0;
padding:0;
}
h2 {
font-size:12px;
margin:0;
padding:0;
}
#page-footer .footer-bot {
background-color:#24262b;
font-family:'PT Sans',sans-serif;
font-weight:400;
text-transform:uppercase;
font-size:10px;
color:#adadad;
letter-spacing:.3px;
line-height:18px;
padding-top:5px;
padding-bottom:5px;
}
//Other CSS properties for this page/site
#media (min-width:768px) {
h1 {
font-size:12px;
margin:0;
padding:0;
}
h1 {
font-size:10px;
margin:0;
padding:0;
}
#page-footer .footer-bot {
line-height:25px;
padding-top:0;
padding-bottom:0;
}
}
This is the right method to use media query breakpoints.
h1 {
font-size:14px;
margin:0;
padding:0;
}
#media (min-width:768px) {
h1 {
font-size:12px;
}
}
Only add that code which you want to make changes in breakpoints. No need to repeat same code in media query.
About grouping CSS you can use both the method. If you have used First method your code will be so long. So, my suggestion is you should go for second method
I'm using a Wordpress theme with a MLS search box however the search box is too large for my client and they want us to reduce the size of this entire search box. I've been playing with it but to no avail. Any suggestions?
Site is http://shouldirentorbuyahome.com/
}
/*-------------------------------------
4.3 Advance Search
-------------------------------------*/
.advance-search-block { background:#F2F2F2; padding:5px 0 10px; position:relative; }
.advance-search-block label { display:block; font-weight:200; font-size:12px; color:#384042; margin-bottom:10px; }
.advance-search-block ul { width: 80%; }
.advance-search-block ul li { float:left; margin-right:15px; margin-bottom:15px; }
.advance-search-block input[type='text'] { font-size:10px; color:#777; padding:8px 8px 9px; width:75px; border:1px solid #E1E1E1; }
.advance-search-block select.small, .advance-search-block a.small { width:150px !important; }
.advance-search-block input[type='submit'] { background:#445064; color:#FFF; padding:8px 11px; font-size:12px; font-weight:200; cursor:pointer; }
.advance-search-block input[type='submit']:hover { background:#344053; }
.search-title { position:absolute; top:0px; }
.search-title h4 { background:#445064; padding:18px 25px; font-size:12px; font-weight:200; float:left; color:#FFF; margin-bottom:0; }
.search-title span { float:left; display:block; background:#88C354; color:#FFF; font-size:12px; padding:18px 20px; }
.advance-search-block.advance-search-block-page { background:none; padding:0; margin-top:-200px; }
.advance-search-block.advance-search-block-page .inside { background:#dcecce; background:rgba(220,236,206,0.8); padding:30px 30px 0; width:1020px; }
.advance-search-block.advance-search-block-page ul li { margin-right:15px; }
.advance-search-block.advance-search-block-page input[type="text"] { width:150px; }
.advance-search-block.advance-search-block-page .search-title { position:relative; top:0; }
.advance-search-block.advance-search-block-page .search-title h4 { background:none; padding:0; font-size:12px; color:#384042; }
.advance-search-block.advance-search-block-page .search-title span {
background:#445064; padding:4px 8px; margin-right:15px; border-radius:50%; -webkit-border-radius:50%; -moz-border-radius:50%;
}
You have
.advance-search-block.advance-search-block-page input[type="text"] { width:150px; }
Can't you just change the width of this element to something not as wide?
Suggest
.advance-search-block.advance-search-block-page input[type="text"] { width:60%; }
Give that a shot and I'm sure you know in wordpress you will need to manually update your styles.css.
If i'm not wrong you are talking about that blue button?
Your blue submit button has a div and it has a class 'dsidx-search-button search-form' with width of 1020px !important , reduce it to 250px !important as per your requirement.
Hi guys i'm using CSS and i'm still learning div in replace of Table and rows. I'm wondering whenever i attached a background image without background just plain image (transparent background) how come it shows a white background on the website outlook even though its background in photoshop is transparent? how do i remove the white background? please direct me to the right track. Thanks
i tried background-color:transparent; it's not working :(
This is my output image used on css div baclground-image http://postimg.org/image/75t1jgqk3/
THis is the view of image having transparent background in Photoshop http://postimg.org/image/o1jddulcx/
here's my css and html code http://jsfiddle.net/XpCmb/
#charset "utf-8";
/* CSS Document */
body
{
margin:0px;
padding:0px;
}
#container
{
padding:30px;
min-width:1024px;
min-height:768px;
background:#d8e0eb;
border:0px;
margin:0px;
}
#container2
{
width:1000px;
height:730px;
background-color:#FFF;
padding-top:25px;
padding-bottom:15px;
}
#wrapper
{
min-width:800;
min-height:600px;
}
#header
{
width:900px;
height:120px;
background-color:violet;
}
#menubar
{
background-color:#FFF;
width:452px;
height:30px;
padding-top:5px;
padding-bottom:5px;
text-decoration: none;
float:;
}
#content
{
width:1000px;
height:40px;
background-color:#f9f2e0;
}
#contentbody
{
width:1000px;
height:auto;
padding-top:50px;
margin-left:0;
margin-right:0;
background-color:#f9f2e0; /*baclground of content holder body */
padding-bottom:100px; /*adjust the space bottom of content holder text */
}
#contentbodytext
{
margin-left:50px;
text-align:left;
}
ul
{
list-style-type:none;
padding:0;
margin:0;
display:inline;
}
li
{
list-style-type:none;
background-color:#;
border-right:1px solid #CCC;
float:left;
padding-left:30px; /*adjust space of menu text to each other*/
padding-right:30px;
padding-top:8px;
padding-bottom:8px;
}
a:link
{
text-decoration:none;
} /* unvisited link */
a:visited {text-decoration:none;
} /* visited link */
li:hover
{
background-color:#ffd640;
}
ul#mcolor li:hover > a
{
background-color:#ffd640; <!-- sets all link color when hovering to yellow -->
}
ul#mcolor li.active a
{
color: rgb(25, 25, 25);
background-color: #ffd640;
}
#mcolor li.active {
background: none repeat scroll 0 0 #ffd640 !important;
}
/*FOLLOWS ARE MISCELLENEOUS LIKE DIVS image holder etc. */
/*ul:hover li
{
opacity: 0.5;
}
ul li:hover
{
opacity: 1;
}
nk */
#image1
{
padding-left:50px;
float:left;
}
#p1a
{
padding-left:350px;
}
#introductiona
{
padding-right:50px;
text-align:justify;
text-align:justify;
}
#p1
{
margin-left:50px;
text-align:left;
margin-top:70px;
}
#bulletin
{
float:left;
margin-left:10px;
background-image:url(bulletinboard.jpg);
background-size:550px 260px;
background-repeat:no-repeat;
width:550px;
height:260px;
background-color:#f9f2e0;
}
Your image is saved as a jpg, which does not save transparency. Save your image as a PNG or a GIF with transparency and you should fix your problem.
http://portfolio.curiouslucious.com/?page_id=8
I'm trying to create a horizontal scrolling gallery (with a edited wordpress theme)
Currently, I have the nextGen Gallery plugin which manages all my images.
Right now, the only way I can get the images to display next to each other and scroll horizontally is to set the gallery width to something massive - 10000px
/* ----------- Gallery style -------------*/
.ngg-galleryoverview {
overflow: hidden;
margin-top: 10px;
width:10000px;
overflow: hidden;
clear:both;
display:inline-block !important;
}
/* ----------- Gallery style -------------*/
is there a way I can make the width change dynamically dependent on the number of images?
here is the stylesheet.css code
/* Blocks */
#container { width:1000px; margin:25px 60px; }
#left-box { float:left; width:270px; margin-right:65px; }
#sidebar { float:right; text-align:right; }
#sidebar ul { text-align:right; list-style:none; }
#sidebar h3 { font-size:1em; }
#sidebar small { font-size:0.7em; font-family:Arial, Helvetica, sans-serif; }
#author_note { font-size:0.85em; width:220px; padding:5px; border:1px solid #CDCDCD; float:right; text-align:right; }
#notes { width:600px; float:left; margin-top:20px; overflow-x:auto; overflow-y:hidden; height:500px; display:inline-block;}
#notes h1 { font-size:1.6em; font-weight:normal; margin:0; padding:0; }
#logo { float:right; margin-top:30px; }
#navigation { clear:right;float:right; width:270px; text-align:right; }
.copyright { margin-top:40px; color:#999999; }
.copyright a { color:#666666; text-decoration:underline; }
.copyright .theme { font-size:0.7em; font-family:Arial, Helvetica, sans-serif; }
.copyright .theme a { color:#999; text-decoration:none; }
.pages { margin-top:80px; font-size:1.1em; font-weight:200; }
.pages li { margin-top:5px; font-size:0.9em; }
.categories { margin-top:45px; font-size:0.85em; }
.links { margin-top:45px; font-size:0.85em; }
.navigation { margin-bottom:50px; font-size:0.85em; }
I'd prefer to avoid javascript if possible as I know I'm going to have huge issues implementing it. But any help would be appreciated.
Thank you!!
If you don't need to support IE7, then you can apply...
.theContent {
display: table;
}
.ngg-galleryoverview {
display: table-row;
float: none;
}
ngg-gallery-thumbnail-box {
display: table-cell;
float: none;
}
Then it will show up as you want to. There will still be some issues, but I'm sure you can take it from there.
I don't think what you're trying to do is possible with pure CSS. I whipped up a custom jQuery plugin that should work with your code.
Demo: http://jsfiddle.net/wdm954/KHT32/4/
I made this so it sets the dimensions dynamically based on the image with the greatest height and the sum of the width of all the images plus the margin-right (so you can add some space between them).
jQuery plugin code...
EDIT :: Fixes!
#scrollGal {
overflow-x: scroll;
overflow-y: hidden;
border: 1px solid black;
padding: 15px;
}
#scrollGal img {
float: left;
margin: 0px;
padding: 0px;
}
#scrollGal div {
margin: 0px;
padding: 0px;
}
#notes {
overflow-x: visible;
overflow-y: visible;
}
EDIT: Remove the "scrollGal" div from your HTML. Replace the JS with the following (the new code will wrap the appropriate div with the scrollGal div)...
(function( $ ){
$.fn.scrollGal = function() {
return this.each(function() {
$(this).wrap('<div id="scrollGal" />');
$sg = $(this).parent();
var obj = $(this).find('img');
var arr = $.makeArray(obj);
var w = 0, ww = 0, h = 0;
$.each(arr, function(i, val) {
w += $(this).width();
w += (parseInt($(this).css('marginRight')));
// find greatest width
var nw = $(this).width();
if (nw > ww) ww = nw;
// find greatest height
var nh = $(this).height();
if (nh > h) h = nh;
});
$sg.width(ww);
$sg.height(h);
$sg.children('div').width(w);
});
};
})( jQuery );
$('#ngg-gallery-1-8').scrollGal();
I downloaded JavaScript code from http://twitter.com to embedded a Twitter Widget in a block on the front page of this site: http://www.fareham.vm.bytemark.co.uk/.
The block renders fine in Google Chrome (10.0.648.133) and Opera (11.01), but in Internet Explorer (7.0.5730.13CO) and Firefox (3.6.15), the block is rendered incorrectly, obscuring the latest news block.
The CSS code is loaded from: http://widgets.twimg.com/j/2/widget.css:
.twtr-widget {
position:relative;
font-size:12px!important;
font-family:"lucida grande",lucida,tahoma,helvetica,arial,sans-serif!important;
zoom:1;
}
.twtr-fullscreen {
font-size:220%!important;
}
.twtr-fullscreen .twtr-new-results {
_display:none!important;
}
.twtr-inactive {
display:none;
}
.twtr-widget a img {
border:0!important;
}
.twtr-doc {
overflow:hidden;
width:100%;
text-align:left;
font-weight:normal;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
}
.twtr-bd {
padding:0 1px;
}
.twtr-widget .twtr-tweet-wrap {
padding:6px 8px;
overflow:hidden;
zoom:1;
}
.twtr-fullscreen .twtr-tweet-wrap {
padding:20px;
}
.twtr-widget .twtr-tweet {
border-bottom:1px dotted #ddd;
overflow:hidden;
zoom:1;
}
.twtr-widget-profile img.twtr-profile-img {
display:block;
float:left;
width:31px;
height:31px;
border:0!important;
}
.twtr-widget h3,.twtr-widget h4,.twtr-widget p {
margin:0!important;
padding:0!important;
line-height:1.2!important;
width:auto!important;
}
.twtr-widget-profile h3,.twtr-widget-profile h4 {
margin:0 0 0 40px!important;
}
.twtr-widget h3 {
font-size:11px!important;
font-weight:normal!important;
}
.twtr-widget h4 {
font-size:16px!important;
}
.twtr-widget em,.twtr-widget .twtr-new-results {
font-size:9px;
font-style:normal;
display:block;
margin-top:2px;zoom:1;
}
.twtr-widget .twtr-new-results {
text-align:center;
padding:3px;
margin:0 auto -10px auto!important;
display:block;
position:relative;
bottom:5px;
line-height:.9;
}
.twtr-results-inner {
line-height:1;
font-size:100%;
padding:4px 0;
position:relative;
bottom:-2px;
width:40%;
margin:0 auto;
z-index:2;
text-align:center;
}
.twtr-results-hr {
width:100%;
position:relative;
z-index:1;
height:1px;
border-bottom:1px dotted #ddd;
bottom:7px;
background:none;
overflow:hidden;
}
.twtr-new-results span {
position:relative;
z-index:3;
top:-14px;
display:block;
font-size:9px!important;
}
.twtr-fullscreen .twtr-new-results span {
font-size:24px!important;
}
.twtr-hd {
padding:10px;
position:relative;
zoom:1;
overflow:hidden;
}
.twtr-fullscreen .twtr-hd {
height:0;
padding:0;
}
.twtr-timeline {
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
position:relative;
overflow:hidden;
z-index:2;
height:225px;
}
.twtr-scroll .twtr-timeline {
overflow-x:hidden;
overflow-y:auto;
}
.twtr-widget .twtr-tweet:last-child {
border-bottom-width:0;
}
.twtr-ft {
position:relative;
}
.twtr-ft div {
overflow:hidden;
padding:10px;zoom:1;
}
.twtr-ft span {
float:right;text-align:right;
}
.twtr-ft a {
float:left;display:block;
}
.twtr-ft a img {
position:relative;
top:2px;
}
.twtr-ft span a {
float:none;
}
.twtr-avatar {
width:40px;
height:40px;
float:left;
overflow:hidden;
display:block;
}
.twtr-fullscreen .twtr-avatar {
width:80px;
height:80px;
}
.twtr-img {
height:25px;
width:25px;
}
.twtr-img img {
width:30px;
height:30px;
}
.twtr-fullscreen .twtr-img img {
width:72px;
height:72px;
}
.twtr-fullscreen a.twtr-join-conv {
display:none;
}
.twtr-tweet-text {
margin-left:40px;
}
.twtr-fullscreen .twtr-tweet-text {
margin-left:90px;
}
.twtr-popular {
font-size:10px;
padding:3px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
display:inline-block;
margin-top:3px;
opacity:.8;
}
.twtr-doc a {
text-decoration:none!important;
}
.twtr-doc a:hover {
text-decoration:underline!important;
}
First of all your problem has nothing to do with positioning.
Your <h2> element which come just before the twitter feed...
<h2>Twitter Timeline</h2>
... is being affected by the following CSS rule: (demo.css, line 10)
.promo-center-2cols .block h2 {
float:left;
width:320px
}
Drop the float:left. The problem is that there is a div shortly after it... (class="twtr-doc")
<h2>Twitter Timeline</h2>
<div class="content">
<div id="twtr-widget-1" class="twtr-widget twtr-widget-profile">
<div class="twtr-doc" style="width:100%;">
... which is being targeted by the following rule: (widget.css line 12)
.twtr-doc {
overflow:hidden;
width:100%;text-align:left;
font-weight:normal;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
}
That float and overflow together are creating your problem. You'll have to change one of them, and since widget.css comes from widgets.twimg.com (Twitter) I assume you can't change it, so change the float value in demo.css.