Centered divs in small size, but in one row on larger sizes in foundation - zurb-foundation

I am trying to create two divs using foundation.
I used this code:
<div id=”containerLeftWrap” class=”small-4 small-centered medium-offset-2 medium-2 medium-uncentered columns” >
…content…
</div>
<div id="containerRight" class="medium-7 columns">
<div id="aboutArea">
…content…
</div>
</div>
In small size it looks fine
but in the medium and large size it looks like this
instead of like this
I've tried to add:
style=”display:inline-block; vertical-align:top”
But then the first div (the smaller one) was stuck to the left side, in all sizes, like this:
Does someone have an idea how to solve this?
Thank you!!!!
Update:
I have this css:
#containerLeftWrap {
background-color: #262626;
height: 256px;
min-width: 245px;
padding-top: 28px;
border-radius: 7px;
margin-top: 60px;
}
#aboutArea {
width: 90%;
margin: 0 auto;
background-color: #262626;
border-radius: 7px;
padding-bottom: 15px;
}

Related

How can I 'if' condition in docment.getElementById.style.background?

.div_wrap_p_bestgames {
display: table;
width: 130px;
height: 40px;
float: left;
background: #1B1C1E;
position: relative;
margin-top: 150px;
margin-left: -100px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
this is css code.
I want to set div_wrap_p_bestgames's mouseout function
if condition with background color #1B1C1E
function onMouseoutNewGames() {
if (document.getElementById("div_wrap_p_newgames").style.background == "#1B1C1E")
///do something
}
this condition is not working
You will need to use the below line to get the background color of an element
document.getElementById("div_wrap_p_newgames").style.backgroundColor
if you need to compare this with a specific value, convert your hex code to a rgb value and compare it as such,
if(document.getElementById("myDiv").style.backgroundColor == "rgb(27, 28, 30)")
rgb(28,27,30) is the equivalent of #1B1C1E
<!DOCTYPE html>
<html>
<body>
<h1>Hello World!</h1>
<div id="myDiv" style="background-color:#1B1C1E;">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Get the background color of div</button>
<script>
function myFunction() {
if(document.getElementById("myDiv").style.backgroundColor == "rgb(27, 28, 30)")
{
alert("hi");
}
}
</script>
</body>
</html>
Works fine when I try it.

overlay text over a image in foundation

Hi I have the following foundation codepen:
https://codepen.io/ianims/pen/PmoqBZ
code:
$(document).ready(function () {
$(document).foundation();
});
body {
background-color: #a3d5d3;
}
#wrap {
position:relative; /* make this relative to have the inner div absolute without breaking out */
/* width: 200px; /* fix the width or else it'll be the entire page's width */
background: silver;
border: 1px solid grey
}
#text {
color:#ffffff;
margin-left: 70%;
position: absolute;
width:250px;
height:60%;
top: 0;
bottom: 0;
background: black;
opacity:0.5;
padding :20px;
}
<div class="row fullWidth">
<div class="large-12 columns">
<div id="wrap">
<div id="text">
<br /><br /><br /><br />
<h3>MCA Coding and MLC Compliance</h3>
<p>
This is some text which I need to show on the right hand side. This is some text which I need to show on the right hand side. This is some text which I need to show on the right hand side. This is some text which I need to show on the right hand side.
</p>
</div>
<img src="https://www.burgessyachts.com/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/0/0/00006250_13.jpg" />
</div>
</div>
</div>
On a large screen it works ok -- I want the text overplayed on the image over to the right - but if you shrink the screen down the text starts to disappear off to the right -- anyone any ideas how to keep it consistent on all screens???
thanks
It's better to position using the left: position as opposed to margin. You might also want to delete the height property so it accomodates more content.
#text {
padding-top: 2em; /*replaces the <br>s in your html*/
color: #ffffff;
position: absolute;
width: 250px;
/*height: 60%;*/
top: 0;
right:7.5%; /* instead of margin*/
background: black;
opacity: 0.5;
padding: 20px;
}
I made a codepen demo:
https://codepen.io/kemie/pen/pPoqOv

How to have autogrow children with flexbox?

I have:
<style>
.parent{
display: flex;
flex-flow: row wrap;
}
.c1{
flex: 1 100%;
background: green;
}
.c2{
flex: 1;
background: red;
}
.c3{
flex: 4;
background: cyan;
}
</style>
<div class="parent">
<div class="c1">100% width</div>
<div class="c2">This text is big and long, and pushes the other div towards the bottom of the page and blabla.</div>
<div class="c3">This should not grow.</div>
</div>
And I wonder if it is posible to have the cyan div not to have 100%. A fixed size doesn't look right because I want it to grow with the flow of text in diferent window sizes.
Just add:
align-items: flex-start;
to the parent div. This makes the children align top and have diferent sizes. Strangely, the default valu for align-items is stretch.

Two floated spans inside li a

Trying to style a few li's in a calendar but having a bit of bother creating two columns inside an li.
Notice the orange does not fill up the area and the two spans do not align...
http://jsfiddle.net/qN4Tp/3/
<ol>
<li>
<a href="#">
<span class="event-time">12:00pm</span>
<span class="event-name">Retail sales grew at their fastest pace in seven years during July, according to the latest data from the British Retail Consortium and KPMG. Sales were up 2.2% year-on-year, driven by…
</span>
</a>
</li>
</ol>
This CSS might help you.
Add an attribute to li. Just add overflow:hidden. And reduce the width of the event_name class. Thats all :)
ol { width: 83%; margin:0; }
li { line-height: 1.2; margin: 0; padding: 5px; list-style-type: none; background: #d4481b; border:1px solid ; color: #ccc; overflow:hidden}
a { text-decoration: none; line-height:1.2}
.event-time { width: 20%; float: left; display:inline}
.event-name { width: 70%; float: left; display:inline}
Here this is the fiddle. http://jsfiddle.net/JPrqT/

Alternatives to illegal <br> or <p> within <li> tags on a hover?

Does anyone have a suggestion for creating paragraph-type line spaces within a <li> tag that includes a hovered pop-up pseudo-class?
I have a <span> that pops up on a:hover and I want the text that pops up to be broken into 2 paragraphs. It works with <br> in FF but I want to do the right thing (now that I've discovered it's wrong!)...
html:
<div id="rightlist">
<ul>
<li><a href="">List item
<span>
words words words that are "paragraph" 1 of List item
<br><br>
different words that make up "paragraph" 2 of List item
</span></a></li>
css:
#rightlist {
margin-top: 10px; margin-right: 5px; width: 387px ; height: 239px ;
background-color: #7EBB11 ;
display: table-cell;
z-index: 100 ;
float: right ;
}
#rightlist ul {
text-align: left;
margin: 0;
margin-top: 6px;
font-family: sans-serif;
font-size: 20px ;
color: black ;
}
#rightlist a
{
display: table-cell;
text-decoration: none; color: black;
background: #7EBB11 ;
}
/*appearance of the <a> item (but before the <span> tag) on hover*/
#rightlist a:hover {
color: white;
}
/*appearance of the spanned content within <a></a> tags when not hovered */
/* %%%%% important - keep position:absolute in this div %%%%% */
#rightlist a span {
display: none;
position: absolute ;
margin-left: -412px;
top: -10px; left: 10px; padding: 10px ;
z-index: 100;
width: 380px; height: 222px;
color: white; background-color: #7EBB11;
font: 0.75em Verdana, sans-serif; font-size: 13px ; color: black;
text-align: left;
}
/*appearance of spanned content within <a> tags when hovered*/
#rightlist a:hover span {
display: table-cell ;
}
Err there's nothing wrong with having <br> inside <a> or <span>. It's perfectly valid according to the HTML 4.01 spec.
Edit: <li> can contain <p>, <br>, and pretty much anything else.
The spec is a bit hard to read but basically says:
LI can contain block or inline
block is made of P + some other things
inline is made of special + some other things
special is made of A + BR + some other things
Regarding <a> it says:
A can contain inline except A
inline... see above
Your problem may arise from the fact that you're using a <span> tag incorrectly.
Spans are supposed to be inline elements and you're styling it as though it were a block element. Admittedly you can force a span to behave as a block element by adding the right style, but this may not always be honoured by the various browsers out there.
Ideally you should be using a div instead. You can then use either p tags or further div tags to indicate the paragraphs (ideally p, since semantically they actually are paragraphs rather than unrelated blocks of text).
You could stick another span in there as a "fake" p tag:
<li><a href="">List item
<span>
<span>words words words that are "paragraph" 1 of List item</span>
<span>different words that make up "paragraph" 2 of List item</span>
</span></a></li>
And in your css:
#rightlist span span {display:block;margin:...}
Note anything you declare for #rightlist span will apply to #rightlist span span, so you might need to override some of the rules in #rightlist span span.
Why is it 'Wrong'?
your br tag should perhaps be coded as:
<br />
Why is your current way wrong ?
You can try this
<span>
<p>words words words that are "paragraph" 1 of List item</p>
<p>different words that make up "paragraph" 2 of List item</p>
</span>