You can view my site live here.
I'm fairly new at designing responsive websites and I'm trying to develop my coding skills. I am trying to make sure that my main navigation and site title look consistent across all screen sizes. However I'm having issues with setting up the CSS properly. I'm usually quick with finding a solution, but for some reason I can't get the result I want to achieve.
The plan is to align the site's title and the navigation below each other and although there numerous ways of doing that, I can't seem to figure out the best practice.
It currently looks messed up and the navigation is being cut off at certain edges. I've tried adding more and removing padding to/from the responsive stylesheet rules.
Current Screenshot
My current navigation looks like this:
CURRENT MARKUP
/*** CURRENT CSS ***/
.title {
font-family: 'Open Sans', sans-serif;
font-weight: 400;
font-size: 13px;
padding:10px;
text-transform:uppercase;
letter-spacing:2px;
color:#00e9d9;
margin-right:232px;
}
#navigation {
background-color:#18161d;
padding-top:4px;
padding-bottom:4px;
font-size: 13px;
letter-spacing:2px;
text-align:center;
font-family: 'Open Sans', sans-serif;
font-weight:700;
font-size:13px;
z-index:1;
overflow:hidden;
color:#00e9d9;
margin-bottom:25px;
}
<!-- CURRENT HTML -->
<div id="navigation">
<span class="title">KATERINA GRAHAM WORLD</span>
<i class="fa fa-home"></i> Homepage
<i class="fa fa-info-circle"></i> Information
<i class="fa fa-camera"></i> Photo Archive
<i class="fa fa-desktop"></i> Website
<i class="fa fa-align-left"></i> Online
</div>
Solved the issue. I didn't think it'd be necessary to create a styling for mobile screen sizes because I thought adding a max-device-width would tell the browser what I wanted 'cause I gave it a max. I should've been way more specific about it and making sure the code DOES have styling for smaller screen sizes zo I added this:
/*------------------------------------------
450px Media
------------------------------------------*/
#media only screen and (max-width: 450px), only screen and (max-device-width: 450px) {
_#header {
background-color:#fff!important;
height:248px!important;
width:auto!important;
overflow:hidden!important;
}
.title {
padding:10px !important;
width:100% !important;
display:block;
}
#navigation a:link {
display: block;
margin: 3px;
padding: 10px !important;
}
#navigation a:active {
display: block;
margin: 3px;
padding: 10px !important;
}
#navigation a:visited {
display: block;
margin: 3px;
padding: 10px !important;
}
#navigation a:hover {
display: block;
margin: 3px;
padding: 10px !important;
}
}
Instead of entirely customising your container, customise the links as well.
E.g.
a {
padding:7px;
margin:0 8px;
color:#00e9d9;
background:#00e9d9
}
I think that you should refer to this answer on this previous question Responsive Web Design Tips, Best Practices and Dynamic Image Scaling Techniques
I really do recommend that you read a little about Design Fundamentals and also read about responsive web design. Here is a few articles to get you started: HTML Responsive Web (W3) and Responsive Web Design: What Is It and How To Use it (Smashing Magazine)
Designing a good, user-friendly responsive website takes time and planning. Personally I like to design each element at a time (e.g I'll design the generic desktop header element then redesign or tweak it for tablet and mobile. Then I'd do the same for the footer and site content.)
Related
I'm trying to get the buttons in my mobile email to stop stacking on top of each other so closely. It looks good in desktop view, but mobile cuts out any space between the buttons.
I've tried adding padding-bottom and margin-bottoms, but they end up making the mobile buttons bigger but still touching.
.buttonstyles {
font-family:arial,helvetica,sans-serif !important;
font-size: 16px !important;
color: #FFFFFF !important;
padding: 10px !important;
}
This code is currently making the buttons touch.
The buttons currently
I think it will work or else plz share your code..
css
.buttonstyles {
display: inline-block
}
Please Try with this code.
.buttonstyles {
background:#000;
color: #FFFFFF;
padding: 10px ;
margin:10px;
float:left;
border:none;
}
<button class="buttonstyles">Demo1</button>
<button class="buttonstyles">Demo2</button>
So here's my problem:
Started working on a website and as the trend goes I went for responsive layout, using bootstrap (12 grid system). So I have to main elements in body which are a heading and an SVG path animation done with LazyLinePainter. So the problem I have is that the heading, is responsive, it stays in the middle no matter the size of the window, yet the animation refuses to do so. I've used same classes on both divs and can't come out with a solution to the problem so that's why I am writing here. I am posting both the html and css:
HTML
http://codepen.io/TresV/pen/bNNZjm.html
CSS
http://codepen.io/TresV/pen/bNNZjm.css
/*=======MAIN CSS=======*/
body {
background:#2ecc71;
}
#pencilandbrackets {
width: 31.5%;
display: block;
margin-top: -155px;
}
#title {
font-family: 'Oswald', sans-serif;
font-size: 4.13em;
position: fixed;
top:40%;
left:50%;
margin: -1.0em 0px 0px -3.2em;
color: #2c3e50;
display: block;
}
.lazy-line svg {
width:300% !important;
}
Here's a life version:
http://thecodehome.tk/new.html
NOTE: Hosting is unreliable so it may not be up at all times.
Thanks in advance for you time and effort!
I have been attempting to make my menu responsive. www.treytrumble.com
It seems that because it is fixed, it will not scale properly when viewed on a device smaller than a laptop. What can I do to make the menu appear like this one when the screen is scaled to smaller than 1,150px wide? http://www.adtile.me
HTML
<div class="contactcontainer">
<div class="contactmenu">Trey Trumble<br /><br/>804-513-7704 <br/><br/>
trey#treytrumble.com<br/><br/>Resume
</div><!-- end .contactmenu -->
</div><!-- end .contactcontainer -->
<div class="container">
<div class="sidebar1">
<table width="120" height="104" border="0">
<tr>
<th scope="col"></th>
</tr>
</table>
<ul class="nav">
<li><img src="images/logo.jpg" width="180"/></li>
<li><a id="webbutton" class="nav">WEB DESIGN</a></li>
<li><a id="printbutton" class="nav">PRINT DESIGN</a></li>
<li><a span class="contactbutton">CONTACT & RESUME</span></a></li></ul>
</div><!-- end .sidebar1 -->
CSS
.content ul, .content ol {
padding: 0 15px 15px 40px;
}
ul.nav {
list-style: none;
border-top: 1px solid #666;
margin-bottom: 15px;
position:fixed;
}
ul.nav li {
border-bottom: 1px solid #666;
letter-spacing: 2px;
font-family: "Helvetica", Arial, sans-serif;
cursor: pointer;
}
ul.nav a, ul.nav a:visited {
padding: 5px 5px 5px 15px;
display: block;
width: 160px;
text-decoration: none;
background: #fff;
inline-box-align:initial;
color:#F60;
}
ul.nav a:hover, ul.nav a:active, ul.nav a:focus {
background:#F60;
color: #FFF;
font-family: "Helvetica", Arial, sans-serif;
letter-spacing: 2px;
font-size: 9px;
}
This is quite simple to accomplish, but it's quite a bit hard to explain. You have to use media queries to accomplish this, maybe even JavaScript.
Media Queries
Chris Coyier has a very interesting article in CSS-TRICKS that explains various concepts of responsive menus here: http://css-tricks.com/responsive-menu-concepts/
As for the main question, you can definitely make that menu responsive, though, I wouldn't suggest you put the exact same layout you have for desktop for mobile, because that would be a problem since the screen is too small, I would suggest making it go all the way to the top like a normal menu, being responsive, you can also fix it to the top and adding a padding-top to the remaining elements so that they don't go below the menu.
If you decide that the menu should be always on top, make sure you add a z-index property to the nav or div element so that no other goes across it too.
FlexBox
There is another approach you can take as well, but depending on what support you're giving to certain browsers I would suggest or not using Flexbox. If you display your navigation as display: flex and you tweak it CSS wise, you can achieve beautiful combinations, but again, remember this is a slightly new CSS3 property, and mainly Internet Explorer has just recently began supporting it.
More about Flexbox can be found here: http://css-tricks.com/snippets/css/a-guide-to-flexbox/
Responsive Design
If you're new to responsive/adaptive design, then sir you have a lot of work to do, but, luckily for you, there are today tons of free and/or paid resources that will give you a pretty good idea of what to do.
I found this article on Team Tree House very useful: http://blog.teamtreehouse.com/beginners-guide-to-responsive-web-design
You can go on from there and start looking for other resources, some of them mentioned on this answer:
Media Queries
Flexbox
Other Tips
If you want to make your menu responsive, you also need to make your site responsive, make sure you have all these:
Responsive viewport tag
HTML5 doctype
A plan (grid system, media queries, flexbox, etc)
Fallbacks for unsupported content
Of course yes,
use media queries to choose the resolution you want it to snap to.
Define your classes within the query and apply it around the menu.
I am new to HTML/CSS and have been working on a website by editing an existing template with HTML 5 responsive features. My workflow consisted of checking back and forth between the code and the Chrome browser.
After I finished the website and was happy with the results, I checked to see how everything was displaying in Firefox and Safari.
To my shock, I suddenly saw that in Firefox the images on a couple of pages were sent completely out of alignment to the far right of the browser (so much so, that I would have to use the horizontal scroller to see the images fully). Throughout the whole development process I had no such problems with Chrome.
However, subsequently I have seen that there are also more slight image display errors for the website in Chrome and Safari on the iPad.
So far I have looked through the questions on this site and also run the w3 online html and css validators. None of these things have worked.
Below I have provided the html of one of the affected images and the relevant css below that.
<figure>
<img src="img/image.jpg" alt="Some text">
<figcaption>Some Text
</br>
(Photo credit: Daniel Easterman)
</figcaption>
</figure>
#main_article img
{
display: block;
border: 0;
max-width: 100%;
height: auto;
padding: 20px 0;
border-bottom: 1px solid #D6D0C1;
}
#main_article figcaption
{
line-height: 25px;
font-size:14px;
max-width:900px;
width:auto;
}
I hope someone can help me figure out why there is this discrepancy between chrome and firefox and what I can do to solve the problem so the images display nicely on both browsers. Thanks very much in advance!
I've looked at your code and can't find anything wrong. Even tested it on jsFiddle.
The problem you're having must have something to do with whatever styling you have for [body] or [container], etc.
basically, you might want to provide the bigger picture so we can help. Maybe share with us the entire style sheet, or whatever is relevant, perhaps the #main_article?
Another thing, is maybe firefox is not happy with custom elements and perhaps you should change figure and figcaption into classes instead (just a guess)
The full main article section is below. Also attached is a screenshot showing the problem in firefox.
#main_article
{
position:relative;
width:auto;
max-width:900px;
margin: 0 auto 20px auto;
}
#main_article h3
{
margin:35px 0 0 0;
font-size:25px;
border-bottom: 1px solid #D6D0C1;
padding: 20px 0;
margin-bottom: 20px;
width:auto;
float:left;
max-width:900px;
}
#main_article h4
{
line-height:25px;
width:auto;
float:left;
font-weight:900;
max-width:900px;
}
#main_article p
{
line-height:25px;
width:auto;
float:left;
font-weight:normal;
padding: 5px 0;
}
#main_article p a
{
text-decoration:none;
color:#00bfff;
}
#main_article p a:hover
{ text-decoration:underline;}
Really simple question, how do I force a link to appear inline with a h2 heading?
I have the following code : http://jsfiddle.net/jezzipin/6DpPX/ and I'd just like the 'Back to top' link to appear inline with the 'Social Media' heading but everything I try doesn't seem to work. Even the use of spans.
Any help would be greatly appreciated.
jme1988
N.B. Just to be clear, this is the effect I am after:
Add this css
.b2t_link{
float:right;
margin-left:0;
}
.page_title{
display:inline-block;
vertical-align:top;
}
Demo
Apply the following styles:
.page_title{
font-size:18px;
font-family: Arial,Helvetica,sans-serif;
font-weight:400;
padding-left:16PX;
/*color:#053452; Dark Blue*/
color: #729ABD;
float:left; //Added float
}
.b2t_link{
float: right;
margin-left: 794px; //Reduced margin by width of page-title
font-family: 'FamiliarProBold',Arial,Helvetica,sans-serif;
font-size: 11px;
color: #729ABD;
}
.two_col_textAndImage_text{
width: 720px;
font-size: 11px;
display: block;
float: left;
padding-left: 5px;
padding-right: 5px;
padding-top: 10px;
min-height: 300px;
}
#main-content{
clear:both;
}
Then in the html wrap the image and text in a div with id main-content.
<div id="main-content">
<div class="two_col_textAndImage_text">
<h2 class="item_title_no_image">Social Media Integrations</h2>
<p class="item_text_no_image">
Social Media is fast becoming a channel for advertising, promoting and applying for vacancies. Some organisations have fully embraced this within their recruitment strategies whilst others have not yet or do not wish to adopt this trend. Whatever the view of your own organisation's recruitment channels, ATS2go has been designed to integrate seamlessly with social media. <br/><br/>
Social Media buttons, such as Facebook, Twitter and LinkedIn can be embedded within you vacancy postings enabling visitors to your site to forward a link to their friends and contacts about your vacancies. In addition, ATS2go includes automative "Job Tweets" for your vacancies which include a link back to your recruitment page; people simply click on the link within the Tweet and can then find out more about the role and hopefully submit their application immediately - simple, easy and free! <br/><br/>
</p>
</div>
<div class="two_col_textAndImage_image">
<img / src="https://text-development.ats2go.com/img/content_images/social-media.jpg" width="250px"/>
</div>
</div>
Example: http://jsfiddle.net/6DpPX/8/
You could put the link inside your h2.
http://jsfiddle.net/lollero/49VNH/1
Alternative view: http://jsfiddle.net/lollero/49VNH/1/show
HTML:
<h2 class="page_title">
Social Media
Back to top
</h2>
CSS:
.b2t_link{
float: right;
}