Why is my header not in the center? [closed] - css

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 8 years ago.
Improve this question
Here's a link:
http://www.cultsectsclothing.com/shop
Can someone please help me? I can't figure out why the header won't center. Instead, it's awkwardly all the way to the right. I feel like it's something really simple but I don't even know...
I have already tried redoing the header on css and in the html cascade layout. It's the same way I do the header on all the other pages. I just need the stupid title to center and for some odd reason it is not.
I checked my tags and made sure they matched up with my 's too. Help??

Give CSS Like this for #header and it will Work No Doubt !
#header {
font-size: 60px;
font-style: oblique;
font-weight: bold;
color: #000;
position: fixed;
top: 30px;
width: 100%;
min-height: 30px;
display: inline-block;
text-align: center;
margin: 0 auto;
}

You can use it for your header:
#header {
width:980px;
height:130px;
margin:0 auto;
}

Instead of
width: 1000px;
Put
width: 100%;
on the #header CSS style.
It will look like this: http://d.pr/i/2OKD
And the fixed will be still there, so, your "logo" will not scroll (like the menu).

try this
#header {
font-size: 60px;
font-style: oblique;
font-weight: bold;
color: #000;
position: fixed;
top: 30px;
width: 100%;
min-height: 30px;
display: inline-block;
text-align: center;
margin: 0 auto;
}

Demo JsFiddle
Add margin: 0 auto; in your #header. This will solve your problem..
HTML
<div id="header">CULT SECTS</div>
CSS
#header {
font-size: 60px;
font-style:oblique;
font-weight:bold;
color: #000;
text-align: center;
margin 0 auto;
width: 100%;
min-height: 30px;
display: inline-block;
}

In context to your code, you simply need to add two properties to your #header rule, which are left: 0 and width: 100% (remove your 1000px as I'm assuming you just want the header to be centered and don't care about an exact width)
See the last 2 properties in the code block below:
#header {
font-size: 60px;
font-style: oblique;
font-weight: bold;
color: #000;
position: fixed;
top: 30px;
min-height: 30px;
display: inline-block;
text-align: center;
left: 0;
width: 100%;
}
http://jsfiddle.net/uberrobert/F4TgR/
This will make your header come back from the right as I see that behavior in Firefox :)

Related

h3 element slips away in mobile device

I have a problem with a h3 element on my web page. It looks ok on desktop, but on mobile devices slips away, as you can see in the following screenshots.
the h3 element is in a div which has the following css:
.experiental-header {
position: absolute;
text-align: center;
width: 100%;
}
and the h3 element has the following css:
.experiental-header h3 {
margin: 0 auto;
width: 635px;
padding: 50px;
background: rgba(255, 255, 255, .5);;
text-align: center;
}
and in mobile device:
I tried in many ways to solve this problem, but none of them has worked well, I don't have too much experience with responsive media queries.
Can you please help me on this? Thank you!
I edited my question:
Now it displays ok, but the text "Experiental" is not changing font size when in responsive mode, as you can see attached:
I have tried with:
font-size: 3em;
but it seems that it is not enough. Can you please advise?
In Experimental-header h3apply width in percentages. So it will works well in responsive.
.experiental-header {
position: absolute;
text-align: center;
width: 100%;
}
.experiental-header h3 {
margin: 0 auto;
width: 30%;
padding: 50px;
background:green;
text-align: center;
font-size: 2.9vw;
}
<div class="experiental-header">
<h3>Heading-3</h3>
</div>

with:100% only way to control centering button?

Having an issue I don't understand. The only way I've been able to center a button on my page perfectly across all devices is if I apply a width: 100% to it.
Issue with this however, is it then makes a sprawling button, way too wide. I'd like to cut it down. The problem is, anytime I get rid of the width: 100% in any way, it makes the perfect button position go haywire.
Any thoughts on how I can have my button centered, but also not super wide and sprawled out. Thank you. -Wilson
link to site: http://www.wilsonschlamme.com/test3.html?
CSS:
img {
width:100%;
max-width:500px;
max-height:340px;
box-shadow: 5px 5px 5px grey;
border-style: groove;
border-width: 1px;
position: absolute;
top: 107px;
}
button {
color: #900;
font-weight: bold;
font-size: 150%;
text-transform: uppercase;
width: 100%;
position: relative;
top: 600px;
}
#ShowText{
width: 800px; /* change to your preferences */
overflow:hidden; /* older browsers */
position: absolute;
margin-top: 500px;
text-align: center;
margin-left: -140px;
font-size: 18px;
font-family: vendetta, serif;
line-height: 25px;
}
h1{
position: absolute;
top: 5px;
font-size: 250%;
width: 800px; /* change to your preferences */
overflow:hidden; /* older browsers */
font-family: hobeaux-rococeaux-sherman, sans-serif;
}
#wrapper {
width: 500px;
margin: 0 auto;
}
take a look at this site there's a complete guide to centering a div.
http://www.tipue.com/blog/center-a-div/
I don't know what's your base using absolute positioning for mostly of your element, but to answer your issue, give text-align:center; to #wrapper, then give text-align:left for each of #wrapper children, except the button.

Safari 8 text-indent bug

We've just launched a new site and are experiencing some problems in older versions of Safari with text-indent. A live link is supplied below, hopefully somebody can help me to debug this issue? I've never experience text-indent issue before.
HTML
<ul>
<li>Prev</li>
<li>Next</li>
<li>Scroll Down</li>
</ul>
CSS
li {
padding: 2px 0;
display: inline-block;
vertical-align: text-top;
font-size: 0.9em;
overflow: hidden;
}
#slide-prev, #slide-next, #scroll-down {
margin-left: 10px;
padding: 0;
}
#slide-prev {
width: 18px;
height: 14px;
background: url(images/ui-sprite.svg) no-repeat 0 -406px;
text-indent: -9999px;
}
#slide-next {
width: 18px;
height: 14px;
background: url(images/ui-sprite.svg) no-repeat -40px -406px;
text-indent: -9999px;
}
#scroll-down {
width: 14px;
height: 14px;
background: url(images/ui-sprite.svg) no-repeat -80px -406px;
text-indent: 9999px;
}
Cross Browser Screenshots
Live Link
A better way to hide text is using this method:
.hide-text{
text-indent: 101%;
white-space: nowrap;
overflow: hidden;
}
.slide-prev {
width: 18px;
height: 14px;
background: url(images/ui-sprite.svg) no-repeat 0 -406px;
}
You can add this class to each of the items to hide the text. In your code above, you are repeating a lot and I also wouldn't recommending using IDs like this in your CSS.
<li>Prev</li>
I have resolved this issue with help from this article.
text-indent only works on block level elements, so it's a case of adding that to the CSS. I have changed my text-indent technique to include white-space and overflow as suggested by #paul-redmond, for a more full proof text-indent solution.
The key was being a block level element however.
CSS
#slide-prev, #slide-next, #scroll-down {
margin-left: 10px;
padding: 0;
display: block;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}

How can I style a header to be a consistent size on many devices?

I've been trying to create responsive website template for myself, I'd like to do it mostly from scratch.
I haven't been able to get the header to size consistently.
I have what I've written here:
header {
background: #222;
height: 60px;
line-height: 60px;
transition: top 0.2s linear;
width: 100%;
overflow: hidden;
text-align: center;
}
.hidden-header-fixed {
top: -60px;
position: fixed;
}
.visible-header-fixed {
top: 0px;
position: fixed;
}
.visible-header-abs {
position: absolute;
}
#logo {
display:inline;
font-size: 30px;
color: #eee;
text-transform: uppercase;
letter-spacing: -1px;
font-weight: bold;
font-family: 'Lato', sans-serif;
text-align: center;
width: 200px;
}
#logo:hover {
color: #aaa;
text-decoration: none;
}
.menu-button {
height: 40px;
width: 40px;
background: #eee;
display:inline;
float: right;
margin: 10px;
border-radius: 20px;
}
In context at: http://jsfiddle.net/7mc3oczp/
When I view the page on my phone though it looks like this:
The header is much too small here to use. I see other sites with a header that has a constant height translate very well to my mobile's browser, how is this accomplished? Why is mine zoomed so far out?
There are two options for doing it.
You can write your own code using media queries for different devices, at first check it, list out your break point & change code for that portion. It's very tedious and time consuming process.
You can do it using framework. It's easier to manage responsiveness using twitter bootstrap, it's easy to learn. Check http://getbootstrap.com and then modify your code using there format.
Did you try to add scale factor to your page?
<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" >

How to use css to style xhtml markup made only of divs like a table [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
See source code of this http://jsbin.com/iveso I can't change anything in xhtml code.
And i need cross browser output exact like this.
alt text http://easycaptures.com/fs/uploaded/445/5025516010.jpg
How we can give same look with less and optimize css
This is CSS
#ConferencesContainer {
overflow: hidden;
}
#ConferencesContainer img {
float: left;
padding: 0 10px 10px 0;
}
#ConferencesContainer #ConferencesItemsContainer img {
float: none;
padding: 0;
}
#ConferencesHeaderContainer {
font-size: 1.1em;
font-weight: bold;
margin: 10px 0;
overflow: hidden;
}
#ConferencesTitleHeaderContainer {
float: left;
width: 40%;
}
#ConferencesPDFHeaderContainer {
float: left;
text-align: center;
width: 20%;
}
#ConferencesExternalLinkHeaderContainer {
float: left;
text-align: center;
width: 20%;
}
#ConferencesHtmlHeaderContainer {
float: left;
text-align: center;
width: 20%;
}
.Conferencesnorth-america-2009ItemContainer {
border-bottom: 1px solid #008999;
overflow: hidden;
padding: 5px 0;
position: relative;
}
.Conferencesaustralia-and-asia-2008ItemContainer {
border-bottom: 1px solid #008999;
overflow: hidden;
padding: 5px 0;
position: relative;
}
.Conferencesinvestor-conference-2008ItemContainer {
border-bottom: 1px solid #008999;
overflow: hidden;
padding: 5px 0;
position: relative;
}
#ConferencesContainer .ConferencesTitleContainer {
float: left;
padding: 2px 0;
width: 40%;
}
#ConferencesContainer .ConferencesPdfContainer {
float: left;
left: 40%;
position: absolute;
text-align: center;
width: 20%;
}
#ConferencesContainer .ConferencesExtLinkContainer {
float: left;
left: 60%;
position: absolute;
text-align: center;
width: 20%;
}
#ConferencesContainer .ConferencesHtmlContainer {
float: left;
left: 80%;
position: absolute;
text-align: center;
width: 20%;
}
#ConferencesAcrobatWarningContainer {
float: left;
padding-top: 20px;
}
.Conferencesaustralia-and-asia-2008ItemContainer #ConferencesasiaTitleContainer {
font-weight: bold;
}
.Conferencesaustralia-and-asia-2008ItemContainer #ConferencesaustraliaTitleContainer {
font-weight: bold;
}
Edit:
I found links which are useful for me
http://snook.ca/archives/html_and_css/getting_your_di
http://www.dev-archive.net/articles/table-in-css.html
"Give a man a fish, and you feed him for a day, teach him to fish, and you feed him for a lifetime"
Ok here we go. If started by installing Firefox so that I can use the Firebug extension.
So you apparently have no control over the the markup which is only made of divs. So far so good.
I changed a fragment of your css by removing #ConferencesContainer as Firebug obviously shows you that there is no div with the id ConferencesContainer in your markup anyway... Which explains why #ConferencesContainer .ConferencesTitleContainer { and alike select nothing.
Then I removed the absolute positioning because as far as I can recall, this is something that doesn't play nice with IE. By the way, having float: left is useless if you then use position: absolute
To accommodate the fact that sometimes there is no pdf download link (hence no div in the markup), I made agenda item and pdf link divs float to the left. And I made biography and webcast divs float to the right and tricked the margins to switch the divs back to their intended position. Tricking the margins was necessary as the webcast div comes first in the markup (in respect to the biography div).
Of course, if you apply the stylesheet I'm giving you to a slightly different markup with "holes", that is to say missing divs because there is no corresponding link to output then it might not work.
In any case, I believe you now have enough to experiment with on your own, good luck.
.ConferencesTitleContainer {
float:left;
padding:2px 0;
width:40%;
background: red;
}
.ConferencesPdfContainer {
float:left;
text-align:center;
width:20%;
background: yellow;
}
.ConferencesExtLinkContainer {
float:right;
margin-left: -20%;
margin-right: 20%;
text-align:center;
width:20%;
background: lime;
}
.ConferencesHtmlContainer {
float: right;
margin-left: 20%;
margin-right: -20%;
text-align:center;
width:20%;
background: pink;
}
(source: pakosz.fr)
See it in action.
And, you might want to read Top 10 CSS Table Designs or 10 CSS Table Examples for pretty styling.
PS: the coder colors are here to help visualizing divs.
I think, you have to play with a bit . Furthermore, you definitely need some images and a lot of patience with the xhtml code and especially the great id & class names.
Here is something that can get you started:
.ConferencesTitleContainer, .ConferencesPdfContainer, .ConferencesExtLinkContainer, .ConferencesHtmlContainer, .ConferencesTitleHeaderContainer, .ConferencesPDFHeaderContainer, .ConferencesExternalLinkHeaderContainer, .ConferencesHtmlHeaderContainer {
float:left;
width:24%;
border-bottom:1px solid;
}
#ConferencesasiaTitleContainer, #ConferencesaustraliaTitleContainer {
width:96%;
font-weight:bold;
}

Resources