I have a Project where many developers are going to inherit my code. I am working mainly on the HTML, CSS and some JavaScript. I am using Foundation 5 and many of the developers (Mostly NodeJS and JavaSCript programmers) are unfamiliar with Responsive Frameworks like Foundation & Bootstrap. They do understand media queries and css very well, but simply have not worked with the 12 column layout etc..
I have a few very complex layout where there are nested grids. I have commented the heck out of these areas so that they will understand if I'm gone or not around to help with something later. I am using comments in conjunction with name="Content-Container", or name="Left-Column" & name="Right-Column". So I am using the name element as kind of description. The pages are super easy to read and understand now despite the complex hierarchy.
I have a comment at the top of each page that says:
<!-- README: This page contains many comments to aid in debugging, etc.. -->
<!-- There are many div's with a name element. These name elements were not-->
<!-- made to be targeted with css. These name elements are descriptions -->
<!-- to aid with understanding their purpose. -->
IS this a good idea? Am I opening up a can of worms by giving them alternate ways of targeting these divs when I'm gone that shouldn't be used when they should instead be using the existing classes and ID's?
Should I not use these names and instead only use commenting? I have never worked with a large team. They seem to understand that I have brought some order and organization to their code. I have completely restructured their entire site, but I don't want to add more complexity if not needed or the ability for them to use these unintentionally.
Your comments are encouraged, I'm seeking advice from those who are used to working on larger teams where they may see me shooting myself in the foot here.
BELOW IS A SAMPLE OF WHAT I'M DOING:
<!--All Content goes inside here. At the time of this writing it
contains two columns that will stack vertically on small screens-->
<div class="row" name="Content-Container">
<!--This is the left hand column that takes up 7 of 12 columns-->
<div class="medium-7 columns" name="Left-Column">
<!--This starts a row to hold many 12 column content containers (Search, Filter, Image & Search Results)-->
<div class="row" name="Left Column Row-Container">
<!-- Start Search Row-->
<div class="medium-12 columns">
<div class="searchWikiMargin">
<form name="searchForm" action="/">
<div class="row collapse">
<div class="small-10 columns">
<input type="search" name="q" id="autoSearch" placeholder="Search local and beyond..." class="placehold">
</div>
<div class="small-2 columns">
Search
</div>
</div>
</form>
</div>
</div>
<!-- End Search Row-->
<!-- Start Filter Navigation Row-->
<div class="medium-12 columns">
<dl class="sub-nav">
<dt>Filter:</dt>
<dd class="active">Web</dd>
<dd>Images</dd>
<dd>News</dd>
<dd>All</dd>
</dl><hr>
</div>
<!-- End Filter Navigation Row-->
<!-- Start Mobile Wiki Results Row ~NO TOP MARGIN SHOWS ONLY ON SMALL SCREENS-->
<div class="small-12 columns show-for-small-only">
<div>
<img src="...">
</div>
</div>
<!-- End Mobile Wiki Results Row-->
<!-- Start Image Results Row-->
<div class="medium-12 columns">
<h5>Image Results For tj hooker</h4>
<ul class="small-block-grid-3">
<li><img class="th" src="eb_images/tj-01.jpg" height="50"></li>
<li><img class="th" src="eb_images/tj-02.jpg" height="50"></li>
<li><img class="th" src="eb_images/tj-03.jpg" height="50"></li>
<li><img class="th" src="eb_images/tj-04.jpg" height="50"></li>
<li><img class="th" src="eb_images/tj-05.jpg" height="50"></li>
<li><img class="th" src="eb_images/tj-06.jpg" height="50"></li>
</ul>
</div>
<!-- End Image Results Row-->
<!-- Start Search Results Row-->
<div class="medium-12 columns">
<h5>Image Results For tj hooker</h4>
<img src="eb_images/tjresults.png">
</div>
<!-- End Search Results Row-->
</div><!--End "Left-Column-Row-Container" -->
</div><!--End "Left-Column" -->
<!--This is the right hand column that takes up 5 of 12 columns-->
<div class="medium-5 columns show-for-medium-up" name="Right-Column">
<!--This starts a row to hold one 12 column content container (Wiki)-->
<div class="row" name="Right-Column-Row-Container">
<!-- Start Mobile Wiki Results Row ~HAS TOP MARGIN & SHOWS ONLY ON MEDIUM & LARGE (DESKTOP) SCREENS-->
<div class="medium-12 columns">
<div class="searchWikiMargin">
<img src="eb_images/tjwiki.png">
</div>
</div>
<!-- End Mobile Wiki Results Row-->
</div><!--End "Right-Column-Row-Container"-->
</div><!--End "Right-Column"-->
</div><!--End Row "Content-Container"-->
This is just one portion of the page.
"Am I opening up a can of worms by giving them alternate ways of targeting these divs "
YES. My reasoning: in the long run you will eventually want all of that extra stuff to lose its usefulness (you want your team to eventually function without extra help).
You answered your own question, I believe.
"Should I not use these names and instead only use commenting?"
YES. Use extra comments, comment the heck out of it. Comments don't change code.
Related
Im customizing a theme in Big Commerce and am having issues. I've never used this platform before and I am having trouble finding where and how to add code. On the home page I've added 2 new parts following the product listings. I dont undrstand the {{partial}} blocks of code. I tried adding my own and it didnt work. What did work was just adding my code to an existing {{partial}}. I added the following to the partial="page":
{{#partial "page"}}
{{#each shipping_messages}}
{{> components/common/alert-info message}}
{{/each}}
<div class="main full">
{{#if products.featured}}
{{> components/products/featured products=products.featured columns=theme_settings.homepage_featured_products_column_count}}
{{/if}}
{{#if products.top_sellers}}
{{> components/products/top products=products.top_sellers columns=theme_settings.homepage_top_products_column_count}}
{{/if}}
{{#if products.new}}
{{> components/products/new products=products.new columns=theme_settings.homepage_new_products_column_count}}
{{/if}}
</div>
<div class="message">
<div class="recycle">
<p class="light">Recycling takes a little effort on your part, but</p>
<div class="recycle-image">
<img src="https://res.cloudinary.com/adamscloud/image/upload/v1518463871/recycled-min_vwz3rb.png">
</div>
<p class="light">makes a Big difference to the World</p>
</div>
<div class="mission">
<h2>Our Mission</h2>
<p class="mission-text">
We offer unique hand crafted, recycle, upcycled, repurposed, comfortable, trendy, creative, cutting edge, ironically humorous, catchy, cool, inspiring items that are unisex and are for people of all ages from all walks of life.</p>
<p class="mission-text">Our goal is to put a smile on the Face of the World by inspiring, entertaining, bringing joy and laughter iinto peoples lives while cherishing our Mother Earth.</p>
<h2>READ MORE</h2>
</div>
</div>
<div class="gallery-image">
<div class="pic-group">
<div class="row">
<div class="small-12 large-3 columns pic-frame"><img class="pics" src="https://res.cloudinary.com/adamscloud/image/upload/v1518476220/gal-1_iryamj.png"></div>
<div class="small-12 large-3 columns pic-frame"><img class="pics" src="https://res.cloudinary.com/adamscloud/image/upload/v1518476222/gal-2_xnmdtp.png"></div>
<div class="small-12 large-3 columns pic-frame"><img class="pics" src="https://res.cloudinary.com/adamscloud/image/upload/v1518476220/gal-3_icq64o.png"></div>
<div class="small-12 large-3 columns pic-frame"><img class="pics" src="https://res.cloudinary.com/adamscloud/image/upload/v1518476223/gal-4_ei72ob.png"></div>
<div class="small-12 large-3 columns pic-frame"><img class="pics" src="https://res.cloudinary.com/adamscloud/image/upload/v1518476224/gal-5_yvljkk.png"></div>
<div class="small-12 large-3 columns pic-frame"><img class="pics" src="https://res.cloudinary.com/adamscloud/image/upload/v1518476224/gal-6_lksrsb.png"></div>
</div>
</div>
</div>
<div class="events pic-group">
<h1>You're Cool, We're Cool,</h1>
<p>come see us at a event near you.</p>
</div>
{{/partial}}
My problem is I cannot get it to work on responsive. When I test on mobile the images are stretched out and 2 are set side by side. I though Big commerce uses Foundation? I tried adding columns to the section but it still doesn't work. Could someone please show me how to make this code I added responsive? Any sources on how to code in Big Commerce because it is frustrating. I am using the cornerstone theme.
To make your gallery grid responsive and use built-in Foundation classes in Cornerstone, set this variable to true in assets/scss/settings/global/_global.scss:
$include-html-classes: true !default;
This variable exposes Foundation classes from Citadel, which is a pattern library custom to Stencil. This PR goes into a bit more detail: https://github.com/bigcommerce/cornerstone/pull/1047
This is probably an easy one, but I'm new to bootstrap and aren't quite familiar with how it works. I have the following code to create 4 even-width columns in a row. But it keeps showing up as 4 vertically stacked columns on my laptop (1920x1080) and I'm not quite sure where I'm doing it wrong.
<div class="container">
<div class="row-fluid">
<div class="col-md-3"><!--about us feature 1st -->
<div class="about-block">
<div class="heading">
<h6>AVAILABILITY</h6>
<p>Fast Response Time<br> 15 Minutes Setup</p>
</div>
</div>
</div><!--about us feature 1st closed -->
<div class="col-md-3"><!--about us feature 2nd -->
<div class="about-block">
<div class="heading">
<h6>SPEED</h6>
<p>Average 7x Faster<br> Complete Data Coverage</p>
</div>
</div>
</div> <!--about us feature 2nd closed -->
<div class="col-md-3"><!--about us feature 3rd -->
<div class="about-block">
<div class="heading">
<h6>SAFETY</h6>
<p>Reduce Human Risk<br> No Scaffolding</p>
</div>
</div>
</div><!--about us feature 3rd closed -->
<div class="col-md-3"><!--about us feature 4th -->
<div class="about-block">
<div class="heading">
<h6>COST SAVINGS</h6>
<p>Targeted Repairs<br> Less Outage Time</p>
</div>
</div>
</div><!--about us feature 4th closed -->
</div>
</div>
UPDATE Added screenshot:
Use col-sm-3 instead, or make your <div> element wider. If you are using a container directly inside body, you shouldn't have any problem. If you are using inside another element, make sure it is wide enough.
First, try changing row-fluid class to style="float: left". Second, it is true that (in theory) the screen is divided into 12, but 3*4 might be more than 12 (margin, border, etc.). If the first part renders three columns and the 4th underneath, try reducing the size of the columns by setting, for instance, width=24%.
I just need to know how to center the row with the columns titled, 'Hire Safely & Quickly' and 'No Staffing Agencies'. Please disregard the rest of the site as it's unfinished. Code is below, link to the dev website is here: http://staging.liberationmedical.com/new-design/
<div class="container-fluid firstcontainer" style="margin-top: 150px;">
<div class="row row-centered">
<div class="col-md-6">
<h2>Hire Safely & Quickly</h2>
<p class="icon-text1">Only credentialed professionals can use Liberation<br>Medical. As a member, you can review profiles, skills<br>and job bids and select candidates; you can hire<br>locum tenens, nurses and other contract medical<br>professionals.</p>
<p class="icon-text4-subtext"><a class="links" href="#">Sign up for free</a></p>
</div><!-- col-md-3 -->
<div class="col-md-6">
<h2>No Staffing Agencies</h2>
<p class="icon-text3">With Liberation Medical, you'll be able to engage<br>directly with contract medical professionals,
avoid<br>staffing agency fees, and evade miscommunication<br>and mis- representation. Post unlimited jobs and<br>have unlimited contracts for free!</p>
<p class="icon-text4-subtext"><a class="links" href="#">Sign up for free</a></p>
</div><!-- end col-md-3 -->
</div><!-- end row -->
</div><!-- end container-fluid -->
If you are familar with CSS you can edit the corresponding tag in your CSS-File. Have a look here: http://www.w3schools.com/cssref/pr_text_text-align.asp
First of all, your text inside your <p> tags have line breaks in it <br> which is causing your content to not fill in the entire col-md-6 and therefore giving the page a false sense of width. I would find the column width that will suit the width of your content and then offset them to center them in the page. You could do:
<div class="container-fluid firstcontainer" style="margin-top: 150px;">
<div class="row row-centered">
<div class="col-md-3 col-md-offset-3">
<h2>Hire Safely & Quickly</h2>
<p class="icon-text1">Only credentialed professionals can use Liberation<br>Medical. As a member, you can review profiles, skills<br>and job bids and select candidates; you can hire<br>locum tenens, nurses and other contract medical<br>professionals.</p>
<p class="icon-text4-subtext"><a class="links" href="#">Sign up for free</a></p>
</div><!-- col-md-3 -->
<div class="col-md-3 col-md-offset-3">
<h2>No Staffing Agencies</h2>
<p class="icon-text3">With Liberation Medical, you'll be able to engage<br> directly with contract medical professionals, avoid<br>staffing agency fees, and evade miscommunication<br> and mis-representation. Post unlimited jobs and<br>have unlimited contracts for free!
</p>
<p class="icon-text4-subtext">
<a class="links" href="#">Sign up for free</a>
</p>
</div><!-- end col-md-3 -->
</div><!-- end row -->
This should move your columns closer together and also more to the center of the page. You can play around with the offsets and column widths to get it to your liking. Just remember, 12 total columns including offsets.
One other thing that I do is to create a class called center so that I can apply that class to any element I want to make everything centered.
Like this:
.center{text-align:center;}
there is no center class in bootstrap like zurb foundation. you can use .md-offset-3 to center it
How do I fill the first 11 columns with a table, but then have the last 1 column be empty?
Right now my HTML is throwing my <h4> after my <div class='col-md-11' to the right of it just squishing it into the page
my HTML:
<nav class='page_element'>
<div class="table-responsive col-md-11">
<table>
</table>
</div>
<br>
<div class="table-responsive col-md-11">
<table>
</table>
</div>
<hr>
</nav>
<nav class='page_element'>
<div class="table-responsive col-md-11">
</div>
<h4><strong>Question 3</strong></h4>
....
This all got worked out in comments, but here's an answer for good measure.
The Bootstrap classes for col-x-n really aren't meant to be used as standalone classes. They work, sometimes, but, in part because they depend on a styling of float: left, they can have some funky behavior when paired with non-col-x-n classes. It's best, whenever possible, to wrap them in rows.
In that ideal situation, it would look something like this:
<nav class='page_element'>
<div class="row">
<div class="table-responsive col-md-11">
...
</div>
</div>
<h4><strong>Question 3</strong></h4>
</nav>
If that isn't, for one reason or another, a good option, I would suggest against using those classes at all. Particularly in a situation like this, they give you a lot of functionality that you don't need, or even want, like the ability to have two columns sit next to each other.
In that case, I would suggest (and I was about to, but then my computer battery died and you beat me to it) using a good-ol'-fashioned width: x%. It's always nice to bring that kind of design implementation out from your HTML and into a CSS file, but for the sake of simplicity, a style attribute does the same thing.
<nav class='page_element'>
<div class="table-responsive" style="width: 92%">
...
</div>
<h4><strong>Question 3</strong></h4>
</nav>
I picked 92% because that's approximately 11/12, which is what col-md-11 aims for.
I have some segments that are similar on my page, same setup - one icon-logo and one text-area:
<div class="row-fluid">
<div class="span7">
<img src="img/icon2.png" alt="" />
</div>
<div class="span4">
<h6>My Text Area</h6>
<p>Description of that functionality<br>
Multi lines of text<p>
</div>
</div>
Just basically an icon and a description text, started out with having 2 of these which is alright, now there is 8 and i think i would like to gather it in one segment, but then slide between the 8 icons/descriptions.
So my question is, any chance or any component available where i can put in 8 of these in a slider-effect way ? most sliders I've looked at is image sliders, but since i need to have multi-language i don't want to convert the 2 spans into 1 image.
I am not an expert in web development so an example would really be appreciated if its possible.
You can use bootstrap carousel for this.
This is the markup they expect
<div class="carousel-inner">
<div class="active item">[here]</div>
<div class="item">[here]</div>
<div class="item">[here]</div>
</div>
All you need to do is to have your two spans inside the element with class item.
Check this fiddle. Hope this is what you wanted.