I'm working with Carousel, it has indicators and text(both in the same amount of numbers), one indicator for one text/slide. I want the indicator should be the same place i.e it shouldn't move up or down in case text is less or more I achieved this with help of min-height.
Now I want that text should be center i.e same amount of margin from top and indicators so that it looks good, but I'm not able to do that I tried a lot but I couldn't achieve what I want. I saw solutions and tried them but those solutions didn't work for my code.
I hope you people will help me.
HTML:-
<div class="container">
<div class="row">
<div class="col-lg-7 col-md-8">
<div class="award-winning-content">
<h1>Meet an award-winning agency wholly-integrated for these times</h1>
<h1>It's all about communicating with real humanity</h1>
<h1>Person to person.<br/> H2H communication</h1>
<h1>Clients engage us to simplify. Humanize.</h1>
<h1>Make something good far better. And get it right, and remarkable, right away.</h1>
<!-- Carousel Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"><span class="color-line"></span></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
<li data-target="#myCarousel" data-slide-to="4"></li>
</ol>
<!-- Carousel Indicators End -->
<img src="images/refresh-icon.png" alt="" /> REPLAY
</div>
</div>
</div>
</div>
Try to add a wrapper on your <h1> tags, for instance with the class my-text-wrapper.
This class should be a flexbox. You can then align your text using align-items (vertical) and justify-content (horizontal).
.my-text-wrapper{
display: flex;
align-items: center;
justify-content: center;
}
Maybe you have to add height: 100%; to the class, but therefore I would need to have a look at your css.
<div class="my-text-wrapper">
<h1>Meet an award-winning agency wholly-integrated for these times</h1>
</div>
<div class="my-text-wrapper">
<h1>It's all about communicating with real humanity</h1>
</div>
<div class="my-text-wrapper">
<h1>Person to person.<br/> H2H communication</h1>
</div>
<div class="my-text-wrapper">
<h1>Clients engage us to simplify. Humanize.</h1>
</div>
<div class="my-text-wrapper">
<h1>Make something good far better. And get it right, and remarkable, right
away.</h1>
</div>
Related
Greeting all,
I'm a newbie here and I just started my carrier as junior web developer. Can some help me with below situation,
I have a WordPress theme, there's some contents doesn't want to be appear so I'm trying to hide those contents by adding some coding to Additional CSS and the div element that I'm trying to hide don't have any class or id given.
Please consider the example code below (I'm not showing entire code here, its just example code exact the same with html elements)
<div id="shop">
<ul class="products">
<li class="product" style="list-style: none;">
<div class="product-inner">
<div class="product-thumbnail"></div>
<div class="product-summary">
<div class="summary-top"></div>
<div class="summary-bottom">
<div>Contents</div>
<form action="#">Form</form>
<div style="color: red;">Contents needs to be hide</div>
Link
</div>
</div>
</div>
</li>
<li class="product" style="list-style: none;">
<div class="product-inner">
<div class="product-thumbnail"></div>
<div class="product-summary">
<div class="summary-top"></div>
<div class="summary-bottom">
<div>Contents</div>
<form action="#">Form</form>
<div style="color: red;">Contents needs to be hide</div>
Link
</div>
</div>
</div>
</li>
</ul>
</div>
This solution only consider the posted code so not sure if it will also work in the actual wordpress theme, as there might be existing styles that overrides it.
The element to be hidden seems to be an error or helper text that follows a form, so perhaps this can be selected as: a div directly after a form inside summary-bottom.
Example:
.summary-bottom > form + div {
display: none;
}
<div id="shop">
<ul class="products">
<li class="product" style="list-style: none;">
<div class="product-inner">
<div class="product-thumbnail"></div>
<div class="product-summary">
<div class="summary-top"></div>
<div class="summary-bottom">
<div>Contents</div>
<form action="#">Form</form>
<div style="color: red;">Contents needs to be hide</div>
Link
</div>
</div>
</div>
</li>
<li class="product" style="list-style: none;">
<div class="product-inner">
<div class="product-thumbnail"></div>
<div class="product-summary">
<div class="summary-top"></div>
<div class="summary-bottom">
<div>Contents</div>
<form action="#">Form</form>
<div style="color: red;">Contents needs to be hide</div>
Link
</div>
</div>
</div>
</li>
</ul>
</div>
You can select the element with by using the general div tag.
We can specify this further by assuming that the div should always be a child of the .summary-bottom element, and then can either always select the third child or target the general div based on its inline style attribute.
This would leave you either with: .summary-bottom div:nth-child(2) (starting from 0) or .summary-bottom div[style="color: red;"].
Of course, how you can select such an element heavily varies on the real usage, and they are way more possibilities to do so, but both snippets mentioned should work on the above HTML code.
You can use the selector property
.summary-bottom div:nth-child(2) {
display: none;
}
<footer id="colophon" class="site-footer">
<div class="site-footer__form-container widget-area">
<div id="footer-sidebar1">
<?php if(is_active_sidebar('footer-sidebar-1')){
dynamic_sidebar('footer-sidebar-1');
}
?>
</div>
</div>
<div class="site-footer__nav-container">
<div class="site-footer__events">
<h3 class="site-footer__title">Events</h3>
<ul class="site-footer__nav-list">
<li class="site-footer__list-item">
Parade Of Lights
</li>
<li class="site-footer__list-item">
SeaFair
</li>
<li class="site-footer__list-item">
Burials At Sea
</li>
</ul>
</div>
<div class="site-footer__about">
<h3 class="site-footer__title">About us</h3>
<ul class="site-footer__nav-list">
<li class="site-footer__list-item">
Owners
</li>
<li class="site-footer__list-item">
Blog
</li>
</ul>
</div>
<div class="site-footer__contact">
<h3 class="site-footer__title">Weddings</h3>
<ul class="site-footer__nav-list">
<li class="site-footer__list-item">
Wedding Info
</li>
<li class="site-footer__list-item">
Wedding Menus
</li>
</ul>
</div>
</div>
<div class="site-footer__contact-container">
<p class="site-footer__phone">(206) 123-4567</p>
<p class="site-footer__address">
1234 Water St. Seattle, WA 98107
</p>
<div class="site-footer__icons-container">
<div class="site-footer__facebook"></div>
<div class="site-footer__instagram"></div>
<div class="site-footer__twitter"></div>
</div>
</div>
<div class="site-footer__copyright-container">
<p class="site-footer__copywrite">Copyright © 2017 Friendship Charters. All Rights Reserved.</p>
</div>
</footer>
Here I am trying to write the HTML for a footer of a website, and I am wondering if I am correctly following the BEM methodology/style guide. It's pretty confusing to me. I'm never sure if I should create more 'blocks' or not. Would this be correct? Thanks for any insight.
Your code is OK for the BEM syntax. But monolithic, too semantic, and nothing is reusable. I suggest to use the following hierarchy of blocks:
site-footer
widget-area
multi-columns
titled-list (events)
titled-list (about)
titled-list (contact)
contact-box
icon (facebook)
icon (instagram)
icon (twitter)
The HTML code:
<footer id="colophon" class="site-footer">
<div class="site-footer__form-container widget-area">
...
</div>
<div class="site-footer__nav-container multi-columns">
<div class="multi-columns__col titled-list">
<h3 class="titled-list__title">Events</h3>
<ul class="titled-list__ul">
<li class="titled-list-li">
Parade Of Lights
</li>
<li class="titled-list-li">
SeaFair
</li>
<li class="titled-list-li">
Burials At Sea
</li>
</ul>
</div>
<div class="multi-columns__col titled-list">
...
</div>
<div class="multi-columns__col titled-list">
...
</div>
</div>
<div class="site-footer__contact-container contact-box">
<p class="contact-box__phone">(206) 123-4567</p>
<p class="contact-box__address">
1234 Water St. Seattle, WA 98107
</p>
<div class="contact-box__icons-container">
<div class="icon icon--facebook"></div>
<div class="icon icon--instagram"></div>
<div class="icon icon--twitter"></div>
</div>
</div>
<div class="site-footer__copyright-container">
<p class="site-footer__copywrite">Copyright © 2017 Friendship Charters. All Rights Reserved.</p>
</div>
</footer>
Each block is a context. Each element is related to its block context. That means a block is not aware where it is positioned. Only elements can be positioned, related to the parent block. In your example, the elements .site-footer__form-container, .site-footer__nav-container, etc. are responsible for positioning the child blocks .widget-area, .multi-columns, etc. inside the parent block .site-footer.
If a pattern is repeated, remember to reuse the same blocks (.icon) or elements (.multi-columns__col) and add modifiers for possible differences.
Always think how to make your CSS classes reusable in the rest of the Web page (maybe you could use .multi-columns or .icon elsewhere?).
If something could be a block but is small and not reusable elsewhere (the copyright container), then you can keep it as an element in the parent block just because it is simpler.
This question already has answers here:
How to horizontally align ul to center of div?
(5 answers)
Closed 6 years ago.
Edit after duplicate report
Apologies I think the suggested duplicate may actually be a duplicate. I tried it first and it didn't work for me hence a new question. Having looked again with the new suggested answer I realise my issues are probably with the out of the box settings of the tool I am using (codepen.io). I think I probably need to look at this tool instead! (whether its's the tool or the default version of bootstrap I haven't checked yet). Thanks.
I am doing a very noddy little page to try and get some front end know-how. Very basic stuff I think, but I'm struggling to centre a list on my page. Essentially I have plugged in bootstrap and I believe one of these built css classes is adding bullet points to the unordered list which I think is good. When I centre the text though the bullet points go to the left of the page while the text is centred. I thought maybe the answer was to split that section into 3 columns and put my list in the middle column which works to an extent but shifts about when I try different screen sizes (I thought the point of bootstrap was top facilitate handling responsive design!?)
Anyway I wondered if anyone could give me a hint on how to centre my list in a way that it will a) be left justified so that it is along the lines of
Item 1
Item 2
Item 3
but in the centre of the page and b) remain centred regardless of screen sizes ?
This is the rough html. I've tried to cut it down a bit to keep to the essentials but let me know if more information would help. I've tried various css based methods and all have failed but I thought (maybe wrongly!) really the answer ought to be a bootstrap class ? and so have left the example code with my attempted bootstrap attempt. In reality though I'm just curious now to see how it ought to be done so an css answer would be equally well appreciated!
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="well text-center maindiv">
<h1 style="color: green" class="text-primary text-center">The Mighty Diamonds</h1>
<h3 class="text-center">The band that brought joy to the hearts of millions</h3>
<div id="div1" class="well text-center">
<div id="div2">
The Mighty Diamonds were a band from Jamaica</div>
</div>
<h3 class="text-center;">A Brief Biog</h3>
<p class="text-left body-para">[Paragraph text]</p>
<h3>Studio albums</h3>
<div class="container">
<div class="row">
<div class="col-xs-4"></div>
<div class="col-xs-4 text-left">
<ul>
<li><span>1964</span> - Album 1</li>
<li><span>1966</span> - Album 2</li>
<li><span>1967</span> - Authentic Album Vol. 2</li>
<li><span>1996</span> - Greetings from Album 4</li>
<li><span>1998</span> - Ball of Fire</li>
<li><span>2009</span> - From Paris with Love</li>
<li><span>2007</span> - On the Right Track</li>
<li><span>2012</span> - Walk With Me Album</li>
<li><span>2016</span> - Platinum Ska</li>
</ul>
</div>
<div class="col-xs-4"></div>
</div>
</div>
</div>
So I figure that your issue here is that your ul is not centered in container > row > text-left
Add display: inline-block to .container > .row > .text-left > ul to let it take as much width as its contents
Add text-align: center to .container > .row > .text-left to center the ul inside.
Add text-align: left to the ul to justify the list to left.
See demo below:
.container > .row > .text-left {
text-align: center;
}
.container > .row > .text-left > ul {
text-align: left;
display: inline-block;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="well text-center maindiv">
<h1 style="color: green" class="text-primary text-center">The Mighty Diamonds</h1>
<h3 class="text-center">The band that brought joy to the hearts of millions</h3>
<div id="div1" class="well text-center">
<div id="div2">
The Mighty Diamonds were a band from Jamaica</div>
</div>
<h3 class="text-center;">A Brief Biog</h3>
<p class="text-left body-para">[Paragraph text]</p>
<h3>Studio albums</h3>
<div class="container">
<div class="row">
<div class="col-xs-4"></div>
<div class="col-xs-4 text-left">
<ul>
<li><span>1964</span> - Album 1</li>
<li><span>1966</span> - Album 2</li>
<li><span>1967</span> - Authentic Album Vol. 2</li>
<li><span>1996</span> - Greetings from Album 4</li>
<li><span>1998</span> - Ball of Fire</li>
<li><span>2009</span> - From Paris with Love</li>
<li><span>2007</span> - On the Right Track</li>
<li><span>2012</span> - Walk With Me Album</li>
<li><span>2016</span> - Platinum Ska</li>
</ul>
</div>
<div class="col-xs-4"></div>
</div>
</div>
</div>
A more simple solution (if flexbox is an option):
.container > .row > .text-left {
display: flex;
justify-content: center;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="well text-center maindiv">
<h1 style="color: green" class="text-primary text-center">The Mighty Diamonds</h1>
<h3 class="text-center">The band that brought joy to the hearts of millions</h3>
<div id="div1" class="well text-center">
<div id="div2">
The Mighty Diamonds were a band from Jamaica</div>
</div>
<h3 class="text-center;">A Brief Biog</h3>
<p class="text-left body-para">[Paragraph text]</p>
<h3>Studio albums</h3>
<div class="container">
<div class="row">
<div class="col-xs-4"></div>
<div class="col-xs-4 text-left">
<ul>
<li><span>1964</span> - Album 1</li>
<li><span>1966</span> - Album 2</li>
<li><span>1967</span> - Authentic Album Vol. 2</li>
<li><span>1996</span> - Greetings from Album 4</li>
<li><span>1998</span> - Ball of Fire</li>
<li><span>2009</span> - From Paris with Love</li>
<li><span>2007</span> - On the Right Track</li>
<li><span>2012</span> - Walk With Me Album</li>
<li><span>2016</span> - Platinum Ska</li>
</ul>
</div>
<div class="col-xs-4"></div>
</div>
</div>
</div>
I want to embed a youtube video in a bootstrap one page scroll web page, exactly in a carousel video slider.
I have a problem with both Chrome and Firefox (no problem using Safari).
Here is my code:
<section class="videos">
<div class="container">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="false">
<!-- Indicators -->
<ol class="carousel-indicators" style="top:125%">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
</ol>
<div class="carousel-inner" style="top:100px;">
<div class="item active">
<div style="text-align:center;">
<iframe width="853" height="480" src="http://www.youtube-nocookie.com/embed/XXXX?rel=0" frameborder="0" allowfullscreen></iframe>
<div class="carousel-caption">
</div>
</div>
</div>
<div class="item">
<div style="text-align:center;">
<iframe width="853" height="480" src="http://www.youtube-nocookie.com/embed/XXXX?rel=0" frameborder="0" allowfullscreen></iframe>
<div class="carousel-caption">
</div>
</div>
</div>
</div>
I get two error:
In my console I get:
Blocked a frame with origin "https://www.youtube-nocookie.com" from accessing a frame with origin "http://www.domain.com". The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match.
Uncaught Error: Error calling method on NPObject.
The videos, appears as black boxes.
What should I do? Thanks
I'd recommend you using an object for the videos you want to embed in your site instead of the iframe. It has a better web browser independent behaviour and works as well with other video providers that enable sharing (dailymotion, vimeo)
<embed width="756" height="461" style="display: block;" src="http://www.youtube.com/v/nlcIKh6sBtc?autohide=1&version=3?autohide=1&version=3&autoplay=1" type="application/x-shockwave-flash" bgcolor="#000000" scale="scale" allowfullscreen="true" salign="tl" allowscriptaccess="never" wmode="opaque">
The above code snippet is an example of how to share a youtube video on a web page with various parameters. Hope this helped.
I need to know how to create a navigation bar with Unsemantic framework (or 960gs).
My menu structure is
<div>
<ul>
<li></li>
</ul>
</div>.
I have tried so much, but still can't find out the problem.
EDIT
I use wordpress.So it creates navigation menu. the eventual code rendered in the browser is as follows:
<nav role="navigation" class="clearfix black grid-100 grid-parent mobile-grid-100 mar-top10 mar-bottom10" id="wp_nav_menu_wrapper">
<div class="grid-container">
<div class="menu">
<ul>
<li class="page_item page-item-2">
ُSample Page
</li>
<li class="page_item page-item-5">ُSample Page 2
</li>
</ul>
</div>
</div>
</nav>
While my Wordpress markup is as follows:
<div class='grid-100 height-auto black-gray-bg font-tahoma'>
<nav role='navigation' class='clearfix black grid-100 grid-parent mobile-grid-100 mar-top10 mar-bottom10' id='wp_nav_menu_wrapper'>
<div class='grid-container'>
<?php
wp_nav_menu();
?>
</div>
</nav>
</div>
The grid-container class is for the outer container and the grid-parent class for inner or nested containers. In your code you have this backwards.
The grid-parent class lets you align self-contained grids with normal grid items. The container holds all of the grid items. So the grid-parent is just an indicator that the or whatever will contain further items related to its scale and ordering on the page.
You can use this structure, or similar:
<nav class="grid-container">
<ul class="grid-100 grid-parent">
<li class="grid-25">...</li>
<li class="grid-25">...</li>
<li class="grid-25">...</li>
<li class="grid-25">...</li>
</ul>
</nav>