Today I tried use SCCS Compiler (http://leafo.net/scssphp/) and i fell in love with this tool, but I need one more feature.
I generated compressed CSS file like that:
html,body{height:100%;}html,body{height:100%;}html,body{height:100%;}#media all and (max-width:960px){body{height:80%;width:95%;}}#media all and (max-width:480px){body{height:100%;width:90%;}}nav ul{margin:0;padding:0;list-style:none;}nav li{display:inline-block;}nav a{display:block;padding:6px 12px;text-decoration:none;}html,body{height:100%;}html,body{height:100%;}#media all and (max-width:960px){body{height:80%;width:95%;}}#media all and (max-width:480px){body{height:100%;width:90%;}}html,body{height:100%;}
Uncompressed file:
html, body {
height: 100%;
}
html, body {
height: 100%;
}
html, body {
height: 100%;
}
#media all and (max-width: 960px) {
body {
height: 80%;
width: 95%;
}
}
#media all and (max-width: 480px) {
body {
height: 100%;
width: 90%;
}
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
}
nav a {
display: block;
padding: 6px 12px;
text-decoration: none;
}
html, body {
height: 100%;
}
html, body {
height: 100%;
}
#media all and (max-width: 960px) {
body {
height: 80%;
width: 95%;
}
}
#media all and (max-width: 480px) {
html, body {
height: 100%;
}
body {
height: 100%;
width: 90%;
}
}
html, body {
height: 100%;
}
I have this code in string variable in PHP and I need remove duplicates. It's sounds easy, array_unique and that's it. Of course. But i need unique code for normal css and for every media separately. So i need output:
html, body {
height: 100%;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
}
nav a {
display: block;
padding: 6px 12px;
text-decoration: none;
}
#media all and (max-width: 960px) {
body {
height: 80%;
width: 95%;
}
}
#media all and (max-width: 480px) {
html, body {
height: 100%;
}
body {
height: 100%;
width: 90%;
}
}
So this script don't remove html,body { height: 100% } from #media all and (max-width: 480px) because in this media is unique.
Could you help me?
If you can put every media queries at the end of the file I would be happy.
you should use a css optimization like: https://github.com/GoalSmashers/clean-css
and I advise you to use Grunt in combination with scss and cleancss plugins for it instead of using PHP to parse your scss -> css, once you're used to it it's far easier to handle.
Related
.vce-row {
flex-direction: column;
}
global-elements…277104ee8181:1
.rtl .vce-row>.vce-row-content>.vce-col.vce-col--all-last, .rtl.vce-row>.vce-row-content>.vce-col.vce-col--all-last, .vce-row {
margin-left: 0;
}
global-elements…277104ee8181:1
.vce-row, .vce-row-content>.vce-col:last-child, .vce-row>.vce-row-content>.vce-col.vce-col--all-last {
margin-right: 0;
}
global-elements…277104ee8181:1
.vce-row, .vce-row-content {
display: flex;
position: relative;
}
bootstrap.min.css?ver=2.0.2:6
*, ::after, ::before {
-webkit-box-sizing: inherit;
box-sizing: inherit;
}
user agent stylesheet
div {
display: block;
}
.vce-row--col-gap-30>.vce-row-content>.vce-col {
margin-right: 0;
}
#media (min-width: 768px)
global-elements…277104ee8181:1
.vce-row--col-gap-30>.vce-row-content>.vce-col--md-50p {
flex: 0;
flex-basis: calc((100% - 2970px) * .5 + 1470px);
max-width: calc((100% - 2970px) * .5 + 1470px);
}
#media (min-width: 768px)
global-elements…277104ee8181:1
.vce-row--col-gap-30>.vce-row-content>.vce-col {
margin-right: 30px;
}
global-elements…277104ee8181:1
.vce-row--col-gap-30>.vce-row-content>.vce-col {
margin-right: 0;
}
#media (min-width: 768px)
global-elements…277104ee8181:1
.vce-row--col-gap-30>.vce-row-content>.vce-col {
margin-right: 30px;
}
global-elements…277104ee8181:1
.vce-row--col-gap-30>.vce-row-content>.vce-col {
margin-right: 0;
}
#media (min-width: 0)
global-elements…277104ee8181:1
.vce-col--xs-1 {
-ms-flex: 0 0 100%;
flex: 0 0 100%;
max-width: 100%;
}
global-elements…277104ee8181:1
.vce-col {
-ms-flex: 0 0 100%;
flex: 0 0 100%;
max-width: 100%;
box-sizing: border-box;
display: -ms-flexbox;
display: flex;
min-width: 1em;
position: relative;
}
bootstrap.min.css?ver=2.0.2:6
*, ::after, ::before {
-webkit-box-sizing: inherit;
box-sizing: inherit;
}
user agent stylesheet
div {
display: block;
}
<div class="vce-row-container">
<div class="vce-row vce-row--col-gap-30 vce-row-columns--top vce-row-content--top" id="el-ae93b178" data-vce-do-apply="all el-ae93b178">
<div class="vce-row-content" data-vce-element-content="true">
<div class="vce-col vce-col--md-50p vce-col--xs-1 vce-col--xs-last vce-col--xs-first vce-col--sm-last vce-col--sm-first vce-col--md-first vce-col--lg-first vce-col--xl-first" id="el-eacaebbd" data-vce-do-apply="background el-eacaebbd">
<div class="vce-col-inner" data-vce-element-content="true" data-vce-do-apply="padding margin border el-eacaebbd">
<div class="vce-text-block">
<div class="vce-text-block-wrapper vce" id="el-21310b56" data-vce-do-apply="all el-21310b56">
<h2>Page Title</h2><p>Page Content</div></div></div></div>
<div class="vce-col vce-col--md-50p vce-col--xs-1 vce-col--xs-last vce-col--xs-first vce-col--sm-last vce-col--sm-first vce-col--md-last vce-col--lg-last vce-col--xl-last" id="el-bf03877a" data-vce-do-apply="background el-bf03877a">
<div class="vce-col-inner" data-vce-element-content="true" data-vce-do-apply="padding margin border el-bf03877a">
<div class="vce-single-image-container vce-single-image--align-left">
<div class="vce vce-single-image-wrapper" id="el-2393669a" data-vce-do-apply="all el-2393669a">
<figure>
<div class="vce-single-image-inner vce-single-image--border-rounded">
<img class="vce-single-image" src="image link"></div></figure></div></div>
<div class="vce-button--style-basic-container vce-button--style-basic-container--align-center">
<span class="vce-button--style-basic-wrapper vce" id="el-b473842a" data-vce-do-apply="margin el-b473842a">
<a class="vce-button--style-basic vce-button--style-basic--border-rounded vce-button--style-basic--size-medium vce-button--style-basic--color-557cbf--fff" href="Contact us link" title="" data-vce-do-apply="padding border background el-b473842a">Contact us</a></span></div></div></div></div></div></div>
I am new to WordPress so please pardon my question. I have edited a site with Visual Composer, it looks great on desktop view as you can see on the attached picture. On the mobile view, it shifts the image under the text, I want the image to be above the text on mobile view and keep the current layout for desktop view. I looked over the internet and many people suggested to use push and pull but I don't know where to start from.
Thanks
Mobile View
Desktop View
This is happening because the browser reads your screen from left to right, so when compressed to a smaller screen, it puts the content from the left to the top because that would logical for somebody reading your page.
If you provide some source code then we can look and help you with this problem.
Here is a strange one. At least for me anyway. I have an HTML page that is being generated by PHP with a style sheet (css.php) linked in. My original plan was to be able to save the attributes for this file in a MySQL database and then load values into the file using PHP variables at each page load. I was talked out of this because it would use to many server resources to parse this file on each page load. I decided to rewrite this file each time changes were made to the database. Now that I have written a file with preferences.php and changed its name to css.css it no longer sees the correct file. It only sees a one line file that I wrote while initially setting up my code. Now that I have a full file it still uses the one-liner that no longer exists. If I change back to my .php file that is in the same folder (the only difference between the two is the file extension) everything works correctly? Where have I gone wrong? I'm sure it's something simple that I can't see.
here is index.html that is loading the css file
<!doctype html>
<html lang= "en">
<head>
<title>Rogers Enterprises</title>
<link rel= "icon" type= "image/png" href= "images/bc2.JPG">
<meta charset="utf-8">
<link rel="stylesheet" href= "css/css.css" >
<script src="js/js.js"></script>
</head>
and here is my css.css
body { background: linear-gradient(to top right, #ffff00 0%, #000000 100%);
color: #ddd8e4; }
h1 { color: red;
text-align: center; }
div { /*border: 1px solid black; */
padding: 1%;
float: left; }
p.content { text-indent: 2%; }
p.content::first-letter { font-size: 200%;
font-weight: bold;
color: black }
#logo { width: 98%; }
.box { width: 10%; }
#links { width: 100%; }
#desc { width: 86%; }
#footer { width: 98%;
background-color: #104e01;
display: block;
text-align: center; }
.footer { width: 31.33%; }
#login {opacity: 0.2; }
#login-form { max-width: 100%;
display: inline-block;
margin-left: auto;
margin-right: auto;
text-align: left; }
input { border-radius: 5px;
max-width: 25vw; }
img { max-width: 100%;
max-height: 100%; }
/* styles for smart phone */
#media only screen and (min-width: 302px) and (max-width: 640px) {
.box{ position: relative;
width: 98%; } /* desired width */
.box:before{ content: "";
display: block;
padding-top: 16.66666666%; } /*What you want the height to be in relation to the width */
.box-content{ position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0; }
#desc { width: 98%; }
}
#media only screen and (min-width: 0px) and (max-width: 370px) {
#remember_me_label { font-size: 4vw; }
}
/* styles for tablet */
#media only screen and (min-width: 768px) and (max-width: 980px) { /* styles for tablet */
}
This is preferences.php that generates the CSS
$file = fopen("../css/css.css", "w");
$txt = 'body { background: linear-gradient(to top right, #ffff00 0%, #000000 100%);
color: #ddd8e4; }
h1 { color: red;
text-align: center; }
div { /*border: 1px solid black; */
padding: 1%;
float: left; }
p.content { text-indent: 2%; }
p.content::first-letter { font-size: 200%;
font-weight: bold;
color: black }
#logo { width: 98%; }
.box { width: 10%; }
#links { width: 100%; }
#desc { width: 86%; }
#footer { width: 98%;
background-color: #104e01;
display: block;
text-align: center; }
.footer { width: 31.33%; }
#login {opacity: 0.2; }
#login-form { max-width: 100%;
display: inline-block;
margin-left: auto;
margin-right: auto;
text-align: left; }
input { border-radius: 5px;
max-width: 25vw; }
img { max-width: 100%;
max-height: 100%; }
/* styles for smart phone */
#media only screen and (min-width: 302px) and (max-width: 640px) {
.box{ position: relative;
width: 98%; } /* desired width */
.box:before{ content: "";
display: block;
padding-top: 16.66666666%; } /*What you want the height to be in relation to the width */
.box-content{ position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0; }
#desc { width: 98%; }
}
#media only screen and (min-width: 0px) and (max-width: 370px) {
#remember_me_label { font-size: 4vw; }
}
/* styles for tablet */
#media only screen and (min-width: 768px) and (max-width: 980px) { /* styles for tablet */
}';
fwrite($file, $txt);
fclose($file);
My directory structure looks like this
rogersproperties
|___index.html
|___css
| |___css.php
| |___css.css
|___php
|___preferences.php
I'm using wordpress and the theme is Newspaper. I want to center the copyrights text but I don't know how. I have checked the theme panel settings and there's no options to edit that.
Theme panel pic:
I have gone through some answers in the web and they suggested adding codes in the editor but I'm not sure if it's the footer.php or style.css. If the latter, I managed to find the part regarding sub-footer:
Sub Footer
*/
.td-sub-footer-container {
background-color: #0d0d0d;
color: #ccc;
font-size: 12px;
font-family: 'Open Sans', arial, sans-serif;
/* responsive portrait phone */
}
#media (max-width: 767px) {
.td-sub-footer-container {
text-align: center;
padding: 6px 0;
}
}
.td-sub-footer-copy {
line-height: 18px;
margin-top: 8px;
margin-bottom: 8px;
}
/* Sub Footer Menu */
.td-sub-footer-container .td-sub-footer-menu {
float: right;
/* responsive portrait phone */
}
#media (max-width: 767px) {
.td-sub-footer-container .td-sub-footer-menu {
float: none;
}
}
.td-subfooter-menu {
display: inline-block;
margin: 0;
float: right;
/* responsive landscape tablet */
/* responsive landscape tablet */
/* responsive portrait tablet */
/* responsive portrait phone */
}
#media (min-width: 1019px) and (max-width: 1140px) {
.td-subfooter-menu {
padding-right: 40px;
}
}
#media (min-width: 768px) and (max-width: 1018px) {
.td-subfooter-menu {
padding-right: 48px;
}
}
#media (max-width: 767px) {
.td-subfooter-menu {
float: none;
}
}
.td-subfooter-menu li {
display: inline-block;
margin-left: 0;
}
.td-subfooter-menu li a {
margin-right: 16px;
line-height: 34px;
display: inline-block;
color: #ccc;
}
.td-subfooter-menu li a:hover {
color: #4db2ec;
}
.td-subfooter-menu li:last-child a {
margin-right: 0;
}
.td-subfooter-menu ul {
display: none;
}
Thank you for such depth! Here's some CSS you need to add:
.td-pb-span5.td-sub-footer-copy {
float: none;
text-align: center;
margin:0 auto;
}
The reason why you need this is because your subfooter is following some rules that are already established for the rest of your page:
.td-pb-row [class*="td-pb-span"] {
display: block;
min-height: 1px;
float: left;
padding-right: 24px;
padding-left: 24px;
position: relative;
}
Simply removing the immediately above CSS will 'break' the rest of your page's layout.
Edit, to answer comment question:
Apologies, here's a bit more information:
When CSS is being applied to an element that is already being styled by a different selector's rules, there's a calculation of specificity. The CSS I've given you will be fine on its own if added, however, if you'd like to add it to the selector you already have, .sub-footer-copy, then you'd have to add !important to override your already written CSS, like so:
td.sub-footer-copy{
float: none !important;
text-align: center;
margin: 0 auto;
}
This is because the selector .td-pb-row [class*="td-pb-span"] is more specific than the selector .sub-footer-copy. Here's some further reading on this:
https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
Also, I'd like to note that the selector .td-pb-row [class*="td-pb-span"] is an attribute selector referring to a CSS class, so it is similar to .td-pb-row .td-pb-span
I have problem with my Wordpress blog,
in mobile I can't open the post in single page because the post in main page doesn't response with any click or touch on phone,
the div class for post on main page is entry-content.
this mobile styling codes
/* =Mobile Styling
----------------------------------------------- */
#media (max-width: 768px) {
.pull-right {
float: none !important;
}
.pull-left {
float: none !important;
}
.site-info, .copyright {
text-align: right;
}
.footer-nav.nav, .copyright {
float: none;
}
.site-content {
width: 100%;
}
.flex-caption {
display: none;
}
.navbar > .container .navbar-brand {
margin: 0;
}
.navbar-default .navbar-nav > li > a {
line-height: 20px;
padding: 15px 10px;
}
#footer-area {
display: none;
}
.entry-content {
margin-left: 0;
display: inline;
}
Try setting entry-content position:relative and z-index high (like 999) and see what happens. Also try removing display:inline or change do display:block.
Hope it helps
On MyPage are many pictures. In the normal case are 6 pictures in one row. If you change the size of the browser the number of pictures in each row will change. I solved this problem with media queries. In each row the last picture shouldnt get a margin-right: 5px;. But the nth-child wont change its every time the same, thats why the margin isnt correct. What did i wrong?
Here is my php output for the images:
<?php
$sql = "SELECT * FROM bilder";
$result=mysqli_query($db,$sql);
while($row=mysqli_fetch_assoc($result)){
echo "<img class='image' src='$row[bild_pfad]' alt='$row[bild_name]' style='$row[bild_werte]'>";
}
?>
Here is the css:
section{
margin: 0px auto;
width: 925px;
margin-top: 55px;
}
.image{
object-position: center; /* Center the image within the element */
height: 150px;
width: 150px;
object-fit: cover;
margin-right: 5px;
}
.image-margin{
margin-right: 5px;
}
section img:nth-child(6n+6){
margin-right:0;
}
#media only screen and (max-width : 924px) {
/* Five images in each row */
section{
margin: 0px auto;
width: 770px;
margin-top: 55px;
}
section img:nth-child(5n+5){
margin-right:0;
}
}
#media only screen and (max-width : 770px) {
/* Four images in each row */
section{
margin: 0px auto;
width: 615px;
margin-top: 55px;
}
section img:nth-child(4n+4){
margin-right:0;
}
}
#media only screen and (max-width : 615px) {
section{
margin: 0px auto;
width: 460px;
margin-top: 55px;
}
section img:nth-child(3n+3){
margin-right:0;
}
}
#media only screen and (max-width : 460px) {
section{
margin: 0px auto;
width: 305px;
margin-top: 55px;
}
section img:nth-child(2n+2){
margin-right:0;
}
}
I solved my problem. I had to reset the old nth-child code
like this:
section img:nth-child(6n+6){
margin-right:0;
}
#media only screen and (max-width : 924px) {
/* Five images in each row */
section{
margin: 0px auto;
width: 770px;
margin-top: 55px;
}
section img:nth-child(6n+6){
margin-right:5px;
}
section img:nth-child(5n+5){
margin-right:0;
}
}