Got another question open on this problem, but I'll make it more specific here, and may be if I get a right solution here, it will help to fix the rest.
Live link here
http://soloveich.com/pr6/blog/
So, I have a background div for date. For some reason, it only displays correctly on narrow screens, and styling of it doesn't even show in source code on wider ones. The styling is there. Checked it in wp admin panel theme editor.
html
<div class="date3">
<div class="datetxt">
<div class="month"><?php the_time('M ') ?></div>
<div class="day"><?php the_time('j ') ?></div>
</div></div>
css
.date3 {
width:100px;
height: 100px;
border: 2px solid transparent;
border-radius: 100px;
background-color: #7E7E7E;
color: #fff;
text-align: center;
}
#media screen and (max-width: 530px) {
.date3 {
width:100px;
height: 100px;
border-radius: 60px;
}
}
.month {
text-align: center;
margin-top: 12px;
text-transform: uppercase;
font-size: 24px;
font-weight: 200;
font-family: 'Exo 2', sans-serif;
}
.day {
text-align: center;
margin-top: -8px;
text-transform: uppercase;
font-size: 40px;
font-family: 'Exo 2', sans-serif;
}
Also, tried to cheat and set up mediaquery for larger resolution. No luck.
p.s.
all of that started happening after posting a youtube video with post breaker in text
The css for .date3 only exists in media queries that's why it works on lower resolution screens. Try putting it above all the media queries. Should work
Related
I'm currently working on a simple COVID-19 site where some info gathered from some flask code is shown in s, with some CSS making the backgrounds into white boxes. However, I am not completely sure how I can add a "cases" right underneath the number while still being in the box. I'm sorry if my question is slightly unclear. I will show my code below.
HTML I am attempting to use:
<div class="boxed">{{data}}</div>
<div><p>cases</p></div>
CSS I am attempting to use:
.boxed {
font-size: 800%;
width: 700px;
text-align: center;
padding: 80px;
background: whitesmoke;
font-family: 'Ubuntu', Helvetica, Arial, sans-serif;
font-weight: bold;
color: rgb(49,74,128);
margin: 2% auto;
border-radius: 60px;
}
Right now, the "cases" text shows under the box with the number in it, instead of being inside of it.
I apologize if it is kind of a bad or simple question- I am a beginner in making websites. Any help would be greatly appreciated!
Just move the p tag inside div.boxed and add separate CSS for title and cases
.boxed {
font-size: 800%;
width: 700px;
text-align: center;
padding: 80px;
background: whitesmoke;
color: rgb(49,74,128);
margin: 2% auto;
border-radius: 60px;
}
.title {
font-family: 'Ubuntu', Helvetica, Arial, sans-serif;
font-weight: bold;
}
.body {
/* your body styling */
}
<div class="boxed">
<div class="title">{{data}}</div>
<p class="body">cases</p>
</div>
You can move <p>cases</p> inside your .boxed div.
<div class="boxed">
{{data}}
<p>cases</p>
</div>
Then add the styling below to your css.
.boxed p {
font-size: 32px;
}
Testing: https://jsfiddle.net/z3acqfjg/1/
Sorry, this is driving me crazy, I'm sure its simple but cannot crack it.
As per the screen shot, the text is being cut off for mobile devices, I thought it would be an adjustment in the css here by adjusting margins or borders, but no avail to this. Can someone suggest a solution? or point me to a solution?
View the site here www.yostrato.com
#owl-main-text {
height: 180px;
}
#owl-main-text h2 {
font-size: 25px;
text-align: center;
color: #fff;
font-weight: 600;
text-transform: uppercase;
font-weight: 600;
letter-spacing: 10px;
margin-top: 0;
margin-bottom: 7px;
margin-top: 35px;
font-family: "Montserrat";
background-color: rgba(193, 48, 48, 0.79);
}
Change height to min-height here:
#owl-main-text {
min-height: 180px; /* or whatever value */
}
Solved by increasing height to 180px:
#owl-main-text {
height: 180px;
}
Use a media query to increase the height off the red colored div just before the H2 text starts to get cut off.
I'm trying to create a responsive layout, but for some reason, when I wrap the relevant CSS in a media query, it isn't recognized: i.e., if I resize my browser window or check it out on my iPhone, the CSS is not applied. I'm not sure what I'm doing wrong here. Here is the relevant code (note that I'm working with the Types plugin within WordPress, hence all the bracketed stuff):
HTML
<div class="client-stats">
<h3>Stats</h3>
<p><strong>Event Date:</strong> [types field="date-of-event" style="text" format="F j, Y"][/types] </p>
<p><strong>Event Type:</strong> [types field="event-type"][/types]</p>
<p><strong>Special Effects:</strong> [types field="special-effects"][/types]
<p><strong>Equipment Used:</strong> [types field="equipment-used"][/types]</p>
</div>
<div class="client-description">
<div class="portfolio-description">
[wpv-post-body view_template='None']
</div>
</div>
CSS
.client-stats {
width: 325px;
float: left;
margin-right: 15px;
padding: 0 7px 0 35px;
background-color: #333;
background-image: url('/wp-content/uploads/2016/05/paper-1.jpg');
min-height: 350px;
line-height: 1.5;
color: #fff;
}
.client-stats p, strong, h3 {
font-family: "Courier New",monospace;
}
.client-stats h3 {
text-transform: uppercase;
margin-bottom: 20px;
color: #fff;
}
.client-stats strong {
text-decoration: underline;
font-family: "Courier New",monospace;
}
.client-description {
margin-left: 350px;
}
#media only screen and (max-width: 768) {
.client-stats {
width: 100%;
float: none;
margin-right: 0;
}
.client-description {
width: 100%;
margin-left:0;
}
}
If I remove the media query wrap, the CSS is applied fine (so it's not the CSS rules, specifically that are the problem).
The relevant page is here, if that helps: http://107.170.41.117/client/client-6/
#media only screen and (max-width: 768) {
CSS lengths require units. 768 is not a valid width.
This would have been picked up if you had used a validator.
I'm trying to make a headers for the chapters in my short story using a collapsible div. I use two different fonts / styles and three layers of divs to make it look the way I want it to. Unfortunately the text is several pixels too low, and it hurts my eyes when I see it.
I know that inline display doesn't really allow for vertical align (my paddings are ignored). I tried using "inline-block" to no avail. I tried top-padding the left ">" symbol, but that makes the entire construction move downwards. I've been hammering at this for the past 2 hours, I give up :D.
Here is my HTML markup as well as the CSS.
<div class="ShortStoryHeaderDiv" onclick="toggleContentDiv('h1','c1');">
<div class="ShortStoryHeaderCenterDiv">
<div id="h1L" class="ShortStoryHeaderDivLeft">></div>
<div class="ShortStoryHeaderText">Must... align... text</div>
<div id="h1R" class="ShortStoryHeaderDivRight"><</div>
</div>
</div>
CSS:
.ShortStoryHeaderDiv
{
margin-top: 1em;
margin-bottom: 1em;
width: 100%;
height: 3em;
text-align: center;
background-color: #DDD;
cursor: pointer;
}
.ShortStoryHeaderCenterDiv
{
padding-top:0.2em;
width: 70%;
margin-left: auto;
margin-right: auto;
}
.ShortStoryHeaderDivLeft
{
display:inline-block;
padding-right: 3em;
font-family: Verdana;
font-weight: bold;
text-shadow: 0 0 4px #555;
color: #000;
font-size: 17pt;
}
.ShortStoryHeaderDivRight
{
display:inline-block;
padding-left: 3em;
font-family: Verdana;
font-weight: bold;
text-shadow: 0 0 4px #555;
color: #000;
font-size: 17pt;
}
.ShortStoryHeaderText
{
display:inline;
font-family: "Times New Roman", Times, serif;
font-size: 1.5em;
text-align: center;
text-decoration: underline;
color: #00F;
}
You could try and use display:table-cell to vertically-align:middle
or set a height and then set the line height to the same.
e.g. height: 40px; line-height:40px;
Managed to make it work by using this in ShortStoryHeaderText CSS class, thanks to SkelDave for reminding me about vertical align. It is awkward that the padding-top ONLY started to work once that vertical-align: top was specified. It is ignored otherwise.
display:inline-block;
padding-top:3px;
vertical-align:top;
I am really struggling to find what is making the grey space at the bottom of my site. This is the first time I have attempted any coding so any simply put answers would be greatly appreciated. I am sure there are numerous errors in the code / conflicting codes but
I have also been trying media queries which may also be making stuff go wrong? Any help would be really well received... Here is the code so far...
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Your Website</title>
<style>
a:link {
text-decoration: none;
font-family: "georgia";
font-style: normal;
font-size: 20px;
font-weight:lighter;
color: #7a5131;
}
a:visited {
text-decoration: none;
font-family: "georgia";
font-style: normal;
font-weight:lighter;
color: #7a5131;
}
a:hover {
text-decoration: none;
font-style: normal;
font-family: "georgia";
font-weight:lighter;
color: #c57b43;
}
a:active {
text-decoration: none;
font-style: normal;
font-family: "georgia";
font-weight:lighter;
color: #7a5131;
}
* {
padding: 0px;
margin: 0px;
margin-top: -5px;
}
#footer {
position: fixed;
clear: both;
width: 104%;
height: 30px;
bottom: 0;
border: none;
padding: 13px 0 0 0;
text-align:
center; color: #ffffff;
background-color: #ffffff; }
body {
background-color:grey;
height: auto;
background-size: 100% 100%\9
}
}
#container {
width: 100%;
height: auto;
color:blue;
margin-left:0;
padding-left: 0;
margin-top: 0;
padding-top: 0;
position: absolute;
}
#nav {
width: 100%;
height: 100%;
text-align: center;
margin-left:0;
padding-left: 0;
padding-top: 0px;
height: 100px;
font-family: "georgia";
font-weight:lighter;
color: #7a5131;
font-size: 20px;
word-spacing: 20px;
float:left;
}
navtype {
position: absolute;
top: 60px;
left: 0;
width: 100%;
font-family: "georgia";
font-weight:lighter;
color: #7a5131;
font-size: 20px;
word-spacing: 20px;
}
#images {
position: relative;
width:100%; /* you can use % */
height: auto;
font-family: "georgia";
font-weight:lighter;
color: #7a5131;
font-size: 20px;
top: 0px;
}
#fullscreen {
position: relative;
width:100%; /* you can use % */
height: auto;
margin-left: auto;
margin-right: auto;
padding-top: 40px;
padding-bottom: 0px;
min-width: 50%;
text-align: center;
}
#test {
position: absolute;
width:100%; /* you can use % */
height: auto;
margin-left: auto;
margin-right: auto;
min-width: 50%;
text-align: center;
background-size: 100%;
background-position: top center;
background-repeat: no-repeat;
display: block;
}
#ourstory {
position: relative;
width:100%; /* you can use % */
height: auto;
margin-left: auto;
margin-right: auto;
padding-top: 40px;
padding-bottom: 50px;
min-width: 50%;
text-align: center;
background-image: url("/Users/DESIGNHAPPY04/Desktop/NEW
SCROLL DOWNSITE/images/storyback.jpg" );
background-size: 100%;
}
#type {
position: relative;
margin-left: 15%;
margin-right: auto;
max-width: 70%;
font-family: "georgia";
font-style: italic;
font-weight:lighter;
color: #5f4029;
line-height: 180%;
font-size: 15px;
}
#media all and (min-width: 601px) {
#test {background-image:url("/Users/DESIGNHAPPY04/Desktop/NEW
SCROLL DOWN SITE/images/breaker.jpg" );
width:100%;height:100%;
}
}
#media all and (max-width: 600px) {
#test {background-image:url("/Users/DESIGNHAPPY04/Desktop/NEW
SCROLL DOWN SITE/images/breakermobile.jpg" );width:100%;height:100%;
}
#type {
position: relative;
margin-left: 15%;
margin-right: auto;
max-width: 70%;
font-family: "georgia";
font-style: italic;
font-weight:lighter;
color: #5f4029;
line-height: 180%;
font-size: 10px;
}
a:link {
text-decoration: none;
font-family: "georgia";
font-style: normal;
font-size: 13px;
font-weight:lighter;
color: #7a5131;
}
a:visited {
text-decoration: none;
font-family: "georgia";
font-style: normal;
font-weight:lighter;
color: #7a5131;
}
a:hover {
text-decoration: none;
font-style: normal;
font-family: "georgia";
font-weight:lighter;
color: #c57b43;
}
a:active {
text-decoration: none;
font-style: normal;
font-family: "georgia";
font-weight:lighter;
color: #7a5131;
}
* {
padding: 0px;
margin: 0px;
margin-top: -5px;
}
#nav {
width: 100%;
text-align: center;
margin-left:0;
padding-left: 0;
padding-top: 0px;
height: 60px;
font-family: "georgia";
font-weight:lighter;
color: #7a5131;
font-size: 20px;
word-spacing: 20px;
position:relative;
}
navtype {
position: absolute;
top: 30px;
left: 0;
width: 100%;
font-family: "georgia";
font-weight:lighter;
color: #7a5131;
font-size: 20px;
word-spacing: 20px;
}
}
</style>
</head>
<body>
<div id="container">
<div id="nav">
<navtype><span>
Story
Testimonial
Recipes
Spreads
</span></navtype>
<a name="top"></a>
<img src="/Users/DESIGNHAPPY04/Desktop/NEW SCROLL DOWN SITE/ images/headerbar.jpg"
alt="HTML5 Icon"style="width:100%;height:100%">
</div>
<div id="images">
<img src="/Users/DESIGNHAPPY04/Desktop/NEW SCROLL DOWN SITE/ images/landscape.jpg"
alt="HTML5 Icon"style="width:100%;height:100%">
</div>
<div id="ourstory">
<a name="storyanchor"></a>
<div id="images">
<img src="/Users/DESIGNHAPPY04/Desktop/NEW SCROLL DOWN SITE/ images/storypics.png"
alt="HTML5 Icon"style="width:100%;height:100%">
</div>
<div id="type">
How it all began
<br>
The emergence and growth of blogs in the late 1990s coincided with the advent o
web publishing tools that facilitated the posting of content by non tec
(Previously, a knowledge of such technologies as HTML and FTpu Indeed, bloggers do not only produce content to post on theirblogs, but also build social relations
<br><br>
Click Here For More Recipe ideas
</div>
</div>
<a name="testimonial"></a>
<img src="/Users/DESIGNHAPPY04/Desktop/NEW SCROLL DOWN SITE/images/breaker.jpg"
alt="HTML5 Icon"style="width:100%;height:100%">
</div>
<div id="ourstory">
<a name="ourspreads"></a>
<div id="images">
<img src="/Users/DESIGNHAPPY04/Desktop/NEW SCROLL DOWN SITE/ images/jars.png"
alt="HTML5 Icon"style="width:100%;height:100%">
</div>
<div id="type">
Our Spreads and Jams
<br>
The emergence and growth of blogs in the late 1990s coincided with the advent of ` web publishing tools that facilitated the posting of content by non-technical users. (Previously, a knowledge of such technologies as HTML and FTP had been required to publish ;content on the Web.)Indeed, bloggers do not only produce content to post on their blogs, but also build social relations
</div>
<div id="fullscreen">
<a name="recipes"></a>
<div id="images">
<img src="/Users/DESIGNHAPPY04/Desktop/NEW SCROLL DOWN SITE/ images/recipes.jpg"
alt="HTML5 Icon"style="width:100%;height:100%">
</div>
</div>
<div id="test">
</div>
</div>
<div id="footer">
Back to top</p>
</div> <!--END OFCONTAINER browser-->
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="/Users/DESIGNHAPPY04/Desktop/NEW SCROLL DOWN SITE/java/smoothscroll.js"></script>
</body>
</html>
Congratulations on coding your own site. Here are some things that could be causing the odd gap:
Two default CSS styles that will effect spacing
Small space under an image, and this may be your bug. One quick fix is to change the image to display:block;. Another solution is to use vertical-align: bottom;, as demonstrated in this easy article: http://salman-w.blogspot.com/2012/10/remove-space-below-images-and-inline-block-elements.html
Margin Collapse happens when a top or bottom margin from one html element (divs, headings...) touch another without a border, padding or anything else in-between. One margin is deleted or the margins are added together, and will only be applied to one element. Please see this article for more info: http://www.sitepoint.com/web-foundations/collapsing-margins/
Potential problems within your code:
As Sable Foste suggested, run your code through the validator, and concentrate on the code errors. (You may not be able to fix everything the validator suggests.) Remember to fix the errors mentioned in the comments above, along with fixing the missing opening <p> tag in the footer, and removing the extra closing brackets } in the css under the body and navtype. Add the additional media query closing brackets } (they need 2: one for the actual style and one to close the media query). Remember to fix * {padding: 0px; margin:0px; margin-top:-5px;} by removing the margin-top:-5px, and assign this only to the styles that need a -5px top margin. These may seem trivial, but coding errors can wreak havoc on your layout.
It looks like your using <div id="test"> at the bottom to test the media queries. What you can do is use #test {display:none;} to hide the div in the regular css, and turn it back on by adding #test {display:block;} in the media queries. This may help you see if the test div is causing problems.
You asked about using a code snippet. Since this is an entire web page, perhaps a JSFiddle would be helpful.
JSFiddle Tutorial - this site lets you paste your html, css, and scripts in a separate, editable environment. It then displays the results in a small browser window. You can paste the link, and we can troubleshoot and demonstrate the fixes in a real environment. For example, the code you supplied does not show your problem, but if you had it in a JSFiddle, we could see the issue, help troubleshoot it, and offer a real example solution. If you have a JSFiddle example, people are more willing to help.
Useful Info
Developer Tools - learn how to use the built in developer tools in your browser because it'll be your best friend when troubleshooting your site. (Like the rest of us, this won't be your last bug). You can view your html and css code, and it has the added benefit of being able to turn off and even delete html elements and css styles. This helps to quickly find the offending element. It is safe to make edits in this environment because the changes are in the browser, and will not change your real code. Hit F12 in your browser to open developer tools, then use the little arrow and mouse over your elements in the browser window, and the code that displays below. Right click on the element to see more options. You can use Firefox with the downloadable Firebug extensions. This lets you edit the html and css. Lots of people like Chrome's developer tools, and you are in luck because CodeSchool offers a fun, free and easy course. It'll be well worth your time to take this because in the time it takes you to troubleshoot one bug, you could have finished this course.
When using this site, upvote the comments and answers that are helpful, and accept the answer that solves your problem. Upvoting and accepting builds your reputation and shows you are an active participant with your own questions, it builds the reputation of the people that answer your questions, and it builds the reputation of the question. If you find your own solution, it's helpful to post the fix.