Solved

CSS properties replaced by user agent?

Posted on 2010-08-27
2
1,446 Views
Last Modified: 2012-05-10
Using a <hr class="myclass" /> in my html works in Firefox. But in Safari and Chrome it is not displaying the <hr> in the correct style.

Using the developer tools in Safari and Chrome it shows that my <hr> styles are overridden by the User Agent Stylesheet. Does anyone know how to prevent this?
0
Comment
Question by:Gary Samuels
2 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33545089
Are other things not working also?  Do you have an "@charset" in the first line of your CSS file?  If so, remove it.  Safari doesn't seem to like that and Chrome is a 'Webkit' browser also so it often acts just Safari in these things.
0
 

Accepted Solution

by:
Gary Samuels earned 0 total points
ID: 33558494
I was trying to offset the <hr> using padding or margins. Chrome and Safari didn't like it so they ignored the style. I removed the padding or margins, set the style to: float:right width:90% and it worked in all the browsers.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question